v1.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace zin;
  3. class label extends wg
  4. {
  5. /**
  6. * @var mixed[]
  7. */
  8. protected static $defineProps = array(
  9. 'text?:string'
  10. );
  11. public static function getPageCSS()
  12. {
  13. return <<<CSS
  14. .label.status-clarify, .label.status-draft {--tw-ring-color: #8166ee;}
  15. .label.status-cancel, .label.status-canceled, .label.status-investigate {--tw-ring-color: #838a9d;}
  16. .label.status-canceled, .label.status-closed, .label.status-testtask .label.status-done {--tw-ring-color: #9ea3b0;}
  17. .label.status-blocked, .label.status-hangup, .label.status-pause, .label.status-suspended {--tw-ring-color: #b89664;}
  18. .label.status-noreview, .label.status-reviewing, .label.status-wait .label.status-testcase {--tw-ring-color: #18a6fd;}
  19. .label.status-active .label.status-risk, .label.status-changed, .label.status-changing, .label.status-fail {--tw-ring-color: #fb2b2b;}
  20. .label.status-active, .label.status-asked, .label.status-normal, .label.status-unconfirmed, .label.status-wait {--tw-ring-color: #313c52;}
  21. .label.status-active .label.status-issue, .label.status-checking, .label.status-commenting, .label.status-confirmed, .label.status-doing {--tw-ring-color: #ff6f42;}
  22. .label.status-checked, .label.status-done, .label.status-pass, .label.status-replied, .label.status-resolved, .label.status-success {--tw-ring-color: #0dbb7d;}
  23. CSS;
  24. }
  25. public function onAddChild($child)
  26. {
  27. if(is_string($child) && !$this->props->has('text'))
  28. {
  29. $this->props->set('text', $child);
  30. return false;
  31. }
  32. }
  33. public function build()
  34. {
  35. return span
  36. (
  37. setClass('label'),
  38. set($this->getRestProps()),
  39. $this->prop('text'),
  40. $this->children()
  41. );
  42. }
  43. }