_chooser.scss 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. .chooser {
  2. &.blank .chosen {
  3. display: none;
  4. }
  5. &:not(.blank) .unchosen {
  6. display: none;
  7. }
  8. }
  9. // Very subdued button style specifically for choosers, as there can be a lot of
  10. // chooser fields left unused on a page editing form.
  11. .chooser__choose-button {
  12. display: flex;
  13. align-items: center;
  14. border-color: transparent;
  15. padding-inline-start: 0;
  16. // So the outline is slightly more separated from the text.
  17. padding-inline-end: $focus-outline-width;
  18. .icon {
  19. @include svg-icon(theme('spacing.5'), initial);
  20. color: inherit;
  21. margin-inline-end: 5px;
  22. }
  23. &:hover,
  24. &:focus {
  25. color: $color-button-hover;
  26. background-color: $color-white;
  27. }
  28. }
  29. .chosen {
  30. display: flex;
  31. gap: theme('spacing.4');
  32. align-items: center;
  33. }
  34. .chooser__preview {
  35. display: grid;
  36. align-items: center;
  37. justify-content: center;
  38. width: 60px;
  39. height: 60px;
  40. // Prevent this item from getting smaller if the title is long.
  41. flex-shrink: 0;
  42. background-color: theme('colors.grey.150');
  43. color: $color-white;
  44. border-radius: theme('borderRadius.sm');
  45. @media (forced-colors: active) {
  46. border: 1px solid transparent;
  47. }
  48. .icon {
  49. width: theme('spacing.7');
  50. height: theme('spacing.7');
  51. color: inherit;
  52. }
  53. }
  54. .chooser__title {
  55. @apply w-body-text-large;
  56. }
  57. .chooser__actions {
  58. display: flex;
  59. gap: theme('spacing.[1.5]');
  60. .button {
  61. // Subdued border as there can be a lot of chooser action buttons on a page.
  62. border-color: theme('colors.grey.150');
  63. }
  64. // Hiding for devices capable of hover states only,
  65. // with opacity only so keyboard focus can move to the first interactive element to reveal it.
  66. @media (hover: hover) {
  67. opacity: 0;
  68. .chooser:hover &,
  69. .chooser:focus-within & {
  70. opacity: 1;
  71. }
  72. }
  73. }
  74. .chooser__image {
  75. max-width: 200px;
  76. max-height: 140px;
  77. height: auto;
  78. width: auto;
  79. }