|
5 | 5 | height: 100%; |
6 | 6 | @include styles.theme(styles.$white); |
7 | 7 | } |
| 8 | + |
| 9 | +/* |
| 10 | + * Story batch styling, we are wrapping the storybook decorator function to ensure |
| 11 | + * styles do not leak to other components |
| 12 | + * |
| 13 | + * To enable this in stories, pass a component wrapper decorator function in Meta as such: |
| 14 | + * ``` |
| 15 | + * componentWrapperDecorator((story) => `<div class="css-grid-story">${story}</div>`) |
| 16 | + * ``` |
| 17 | + * |
| 18 | + * Styling retrieved from: |
| 19 | + * https://github.com/carbon-design-system/carbon/tree/main/packages/react/src/components/Grid |
| 20 | + */ |
| 21 | + // Css Grid |
| 22 | +.css-grid-story { |
| 23 | + .cds--css-grid { |
| 24 | + background-color: styles.$blue-20; |
| 25 | + outline: 1px dashed styles.$blue-40; |
| 26 | + } |
| 27 | + |
| 28 | + .cds--css-grid p { |
| 29 | + @include styles.type-style('code-02'); |
| 30 | + } |
| 31 | + |
| 32 | + .cds--css-grid p:first-of-type { |
| 33 | + margin-top: 0; |
| 34 | + } |
| 35 | + |
| 36 | + .cds--css-grid.cds--css-grid--narrow { |
| 37 | + background-color: #d6f9f9; |
| 38 | + outline: 1px dashed styles.$green-40; |
| 39 | + } |
| 40 | + |
| 41 | + .cds--css-grid.cds--css-grid--condensed { |
| 42 | + background-color: styles.$purple-10; |
| 43 | + outline: 1px dashed styles.$purple-40; |
| 44 | + } |
| 45 | + |
| 46 | + .cds--subgrid { |
| 47 | + outline: 1px solid black; |
| 48 | + padding-top: 2rem; |
| 49 | + padding-bottom: 2rem; |
| 50 | + position: relative; |
| 51 | + background: #eef4ff; |
| 52 | + } |
| 53 | + |
| 54 | + .cds--css-grid, |
| 55 | + .cds--subgrid--wide { |
| 56 | + --grid-mode-color: #97c1ff; |
| 57 | + } |
| 58 | + |
| 59 | + .cds--css-grid--narrow, |
| 60 | + .cds--subgrid--narrow { |
| 61 | + --grid-mode-color: #20d5d2; |
| 62 | + background: styles.$green-10; |
| 63 | + } |
| 64 | + |
| 65 | + .cds--css-grid--condensed, |
| 66 | + .cds--subgrid--condensed { |
| 67 | + --grid-mode-color: #bb8eff; |
| 68 | + background: styles.$purple-10; |
| 69 | + } |
| 70 | + |
| 71 | + .cds--subgrid--narrow { |
| 72 | + background: #d6f9f9; |
| 73 | + } |
| 74 | + |
| 75 | + .cds--subgrid--condensed { |
| 76 | + background: #f7f2ff; |
| 77 | + } |
| 78 | + |
| 79 | + .cds--subgrid::before { |
| 80 | + @include styles.type-style('code-01'); |
| 81 | + position: absolute; |
| 82 | + inset-block-start: 0; |
| 83 | + inset-inline-start: 0; |
| 84 | + display: block; |
| 85 | + content: 'subgrid'; |
| 86 | + background: var(--grid-mode-color, #97c1ff); |
| 87 | + color: styles.$black; |
| 88 | + padding: 0.125rem 0.25rem; |
| 89 | + } |
| 90 | + |
| 91 | + .cds--css-grid-column { |
| 92 | + --border-color: #97c1ff; |
| 93 | + |
| 94 | + background: white; |
| 95 | + box-shadow: 0 0 0 1px var(--border-color); |
| 96 | + min-height: 80px; |
| 97 | + } |
| 98 | + |
| 99 | + .cds--css-grid--narrow .cds--css-grid-column, |
| 100 | + .cds--subgrid--narrow .cds--css-grid-column { |
| 101 | + --border-color: #20d5d2; |
| 102 | + } |
| 103 | + |
| 104 | + .cds--css-grid--condensed .cds--css-grid-column, |
| 105 | + .cds--subgrid--condensed .cds--css-grid-column { |
| 106 | + --border-color: #bb8eff; |
| 107 | + } |
| 108 | +} |
| 109 | + |
| 110 | +// Flex Grid |
| 111 | +.flex-grid-story { |
| 112 | + .cds--grid [class*='col'] { |
| 113 | + background-color: styles.$blue-20; |
| 114 | + outline: 1px dashed styles.$blue-40; |
| 115 | + min-height: 80px; |
| 116 | + } |
| 117 | + |
| 118 | + .inside { |
| 119 | + background-color: styles.$blue-10; |
| 120 | + height: 100%; |
| 121 | + width: inherit; |
| 122 | + } |
| 123 | + |
| 124 | + .cds--grid--condensed, |
| 125 | + .cds--row--condensed { |
| 126 | + background-color: styles.$blue-20; |
| 127 | + color: styles.$gray-10; |
| 128 | + } |
| 129 | + |
| 130 | + .cds--grid--condensed .inside, |
| 131 | + .cds--row--condensed .inside { |
| 132 | + background-color: styles.$teal-10; |
| 133 | + } |
| 134 | + |
| 135 | + .cds--grid--condensed [class*='col'], |
| 136 | + .cds--row--condensed [class*='col'] { |
| 137 | + background-color: styles.$teal-20; |
| 138 | + outline: 1px dashed styles.$teal-40; |
| 139 | + } |
| 140 | + |
| 141 | + .cds--grid--narrow .inside, |
| 142 | + .cds--row--narrow .inside { |
| 143 | + background-color: styles.$teal-10; |
| 144 | + } |
| 145 | + |
| 146 | + .cds--grid--narrow [class*='col'], |
| 147 | + .cds--row--narrow [class*='col'] { |
| 148 | + background-color: styles.$teal-20; |
| 149 | + outline: 1px dashed styles.$teal-40; |
| 150 | + } |
| 151 | +} |
0 commit comments