_nested-panel.scss 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. $header-icon-size-sm: theme('spacing.5');
  2. $header-button-size-sm: theme('spacing.8');
  3. $header-gap: theme('spacing.1');
  4. $panel-x-offset: calc($header-button-size-sm / 2 + $header-gap);
  5. /**
  6. * Panel styles shared between StreamField and InlinePanel,
  7. * for repeating collapsible panels which can be reordered.
  8. * Top-level and nested panels have guiding borders to show their start and end,
  9. * as well as indentation for nested panels.
  10. */
  11. // Styles for the top-level panel, and any panel within.
  12. .w-panel--nested {
  13. .w-panel__divider {
  14. @include guide-line-horizontal();
  15. // Slightly nicer text alignment.
  16. margin-top: 1px;
  17. }
  18. .w-panel__content {
  19. @include guide-line-vertical();
  20. // Center the vertical line.
  21. margin-inline-start: calc(-1 * theme('spacing.3'));
  22. padding-inline-start: theme('spacing.3');
  23. @include media-breakpoint-up(sm) {
  24. margin-inline-start: calc(-1 * $panel-x-offset);
  25. padding-inline-start: $panel-x-offset;
  26. }
  27. }
  28. .w-panel__anchor {
  29. // Mask the overlap with the parent panel’s guide line.
  30. background-color: $color-white;
  31. }
  32. }
  33. // Styles for nested panels excluding the top level.
  34. .w-panel--nested .w-panel {
  35. @include guide-line-nested();
  36. // Indentation for nested panels.
  37. margin-inline-start: theme('spacing.7');
  38. margin-bottom: theme('spacing.6');
  39. // Tighter spacing for nested panel headers so their icons align
  40. // with parent panels’ guiding line.
  41. .w-panel__header {
  42. gap: 0;
  43. transform: translateX(
  44. calc(var(--w-direction-factor) * -1 * theme('spacing.5'))
  45. );
  46. @include media-breakpoint-up(sm) {
  47. transform: translateX(
  48. calc(var(--w-direction-factor) * theme('spacing.1'))
  49. );
  50. }
  51. }
  52. .w-panel__heading--label {
  53. // Use smaller labels within nested panels in InlinePanel.
  54. @apply w-label-2;
  55. }
  56. // For nested panels, there is always enough space for the prefix anchor.
  57. .w-panel__anchor--prefix {
  58. display: inline-grid;
  59. }
  60. // Nested panels never need the suffix anchor.
  61. .w-panel__anchor--suffix {
  62. display: none;
  63. }
  64. }