_nested-panel.scss 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. @include guide-line-active();
  14. .w-panel__divider {
  15. @include guide-line-horizontal();
  16. // Slightly nicer text alignment.
  17. margin-top: 1px;
  18. }
  19. .w-panel__content {
  20. @include guide-line-vertical();
  21. // Center the vertical line.
  22. margin-inline-start: calc(-1 * theme('spacing.3'));
  23. padding-inline-start: theme('spacing.3');
  24. @include media-breakpoint-up(sm) {
  25. margin-inline-start: calc(-1 * $panel-x-offset);
  26. padding-inline-start: $panel-x-offset;
  27. }
  28. }
  29. .w-panel__anchor {
  30. // Mask the overlap with the parent panel’s guide line.
  31. background-color: $color-white;
  32. }
  33. .w-panel__heading--label {
  34. // Use smaller labels within nested panels in InlinePanel.
  35. @apply w-label-2;
  36. }
  37. }
  38. // Styles for nested panels excluding the top level.
  39. .w-panel--nested .w-panel {
  40. @include guide-line-nested();
  41. // Indentation for nested panels.
  42. margin-inline-start: theme('spacing.7');
  43. margin-bottom: theme('spacing.6');
  44. // Tighter spacing for nested panel headers so their icons align
  45. // with parent panels’ guiding line.
  46. .w-panel__header {
  47. gap: 0;
  48. transform: translateX(calc(-1 * theme('spacing.5')));
  49. @include media-breakpoint-up(sm) {
  50. transform: translateX(theme('spacing.1'));
  51. }
  52. }
  53. // For nested panels, there is always enough space for the prefix anchor.
  54. .w-panel__anchor--prefix {
  55. display: inline-grid;
  56. }
  57. // Nested panels never need the suffix anchor.
  58. .w-panel__anchor--suffix {
  59. display: none;
  60. }
  61. }