|
1 | | -// Layout component |
2 | | - |
3 | | -.Layout { |
4 | | - display: grid; |
5 | | - |
6 | | - --Layout-sidebar-width: #{map-get($sidebar-width, 'sm')}; |
7 | | - --Layout-gutter: 16px; |
8 | | - |
9 | | - @media (max-width: calc(#{$width-sm} - 0.02px)) { |
10 | | - @include flow-as-row; |
11 | | - } |
12 | | - |
13 | | - &.Layout--flowRow-until-md { |
14 | | - @media (max-width: calc(#{$width-md} - 0.02px)) { |
15 | | - @include flow-as-row; |
16 | | - } |
17 | | - } |
18 | | - |
19 | | - &.Layout--flowRow-until-lg { |
20 | | - @media (max-width: calc(#{$width-lg} - 0.02px)) { |
21 | | - @include flow-as-row; |
22 | | - } |
23 | | - } |
24 | | - |
25 | | - // Flow as column |
26 | | - |
27 | | - grid-auto-flow: column; |
28 | | - grid-template-columns: auto 0 minmax(0, calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter))); // sidebar column, separator, main column |
29 | | - grid-gap: var(--Layout-gutter); |
30 | | - |
31 | | - .Layout-sidebar { |
32 | | - grid-column: 1; |
33 | | - } |
34 | | - |
35 | | - .Layout-divider { |
36 | | - display: none; |
37 | | - } |
38 | | - |
39 | | - .Layout-main { |
40 | | - grid-column: 2 / span 2; |
41 | | - } |
42 | | - |
43 | | - // Gutter spacing |
44 | | - |
45 | | - @include breakpoint(lg) { |
46 | | - --Layout-gutter: 24px; |
47 | | - } |
48 | | - |
49 | | - &.Layout--gutter-none { |
50 | | - // stylelint-disable-next-line length-zero-no-unit |
51 | | - --Layout-gutter: 0px; |
52 | | - } |
53 | | - |
54 | | - &.Layout--gutter-condensed { |
55 | | - --Layout-gutter: 16px; |
56 | | - } |
57 | | - |
58 | | - &.Layout--gutter-spacious { |
59 | | - @include breakpoint(lg) { |
60 | | - --Layout-gutter: 32px; |
61 | | - } |
62 | | - |
63 | | - @include breakpoint(xl) { |
64 | | - --Layout-gutter: 40px; |
65 | | - } |
66 | | - } |
67 | | - |
68 | | - // Sidebar width |
69 | | - |
70 | | - @each $breakpoint in map-keys($sidebar-width) { |
71 | | - @include breakpoint($breakpoint) { |
72 | | - --Layout-sidebar-width: #{map-get($sidebar-width, $breakpoint)}; |
73 | | - } |
74 | | - } |
75 | | - |
76 | | - &.Layout--sidebar-narrow { |
77 | | - @each $breakpoint in map-keys($sidebar-narrow-width) { |
78 | | - @include breakpoint($breakpoint) { |
79 | | - --Layout-sidebar-width: #{map-get($sidebar-narrow-width, $breakpoint)}; |
80 | | - } |
81 | | - } |
82 | | - } |
83 | | - |
84 | | - &.Layout--sidebar-wide { |
85 | | - @each $breakpoint in map-keys($sidebar-wide-width) { |
86 | | - @include breakpoint($breakpoint) { |
87 | | - --Layout-sidebar-width: #{map-get($sidebar-wide-width, $breakpoint)}; |
88 | | - } |
89 | | - } |
90 | | - } |
91 | | - |
92 | | - // Sidebar position |
93 | | - |
94 | | - &.Layout--sidebarPosition-start { |
95 | | - .Layout-sidebar { |
96 | | - grid-column: 1; |
97 | | - } |
98 | | - |
99 | | - .Layout-main { |
100 | | - grid-column: 2 / span 2; |
101 | | - } |
102 | | - } |
103 | | - |
104 | | - &.Layout--sidebarPosition-end { |
105 | | - grid-template-columns: minmax(0, calc(100% - var(--Layout-sidebar-width) - var(--Layout-gutter))) 0 auto; |
106 | | - |
107 | | - .Layout-main { |
108 | | - grid-column: 1; |
109 | | - } |
110 | | - |
111 | | - .Layout-sidebar { |
112 | | - grid-column: 2 / span 2; |
113 | | - } |
114 | | - } |
115 | | - |
116 | | - // Sidebar divider |
117 | | - |
118 | | - &.Layout--divided { |
119 | | - .Layout-divider { |
120 | | - display: block; |
121 | | - grid-column: 2; |
122 | | - width: 1px; |
123 | | - // stylelint-disable-next-line primer/spacing |
124 | | - margin-right: -1px; |
125 | | - background: var(--color-border-default); |
126 | | - } |
127 | | - |
128 | | - .Layout-main { |
129 | | - grid-column: 3 / span 1; |
130 | | - } |
131 | | - |
132 | | - &.Layout--sidebarPosition-end { |
133 | | - .Layout-sidebar { |
134 | | - grid-column: 3 / span 1; |
135 | | - } |
136 | | - |
137 | | - .Layout-main { |
138 | | - grid-column: 1; |
139 | | - } |
140 | | - } |
141 | | - } |
142 | | -} |
143 | | - |
144 | | -.Layout-divider { |
145 | | - display: none; |
146 | | - width: 1px; |
147 | | -} |
148 | | - |
149 | | -.Layout-sidebar { |
150 | | - width: var(--Layout-sidebar-width); |
151 | | -} |
152 | | - |
153 | | -.Layout-main { |
154 | | - min-width: 0; |
155 | | - |
156 | | - // Centered main column |
157 | | - // FIXME: right-aligned sidebar |
158 | | - .Layout-main-centered-md, |
159 | | - .Layout-main-centered-lg, |
160 | | - .Layout-main-centered-xl { |
161 | | - margin-right: auto; |
162 | | - margin-left: auto; |
163 | | - |
164 | | - > .container-md, |
165 | | - > .container-lg, |
166 | | - > .container-xl { |
167 | | - margin-left: 0; |
168 | | - } |
169 | | - } |
170 | | - |
171 | | - .Layout-main-centered-md { |
172 | | - max-width: calc(#{$container-md} + var(--Layout-sidebar-width) + var(--Layout-gutter)); |
173 | | - } |
174 | | - |
175 | | - .Layout-main-centered-lg { |
176 | | - max-width: calc(#{$container-lg} + var(--Layout-sidebar-width) + var(--Layout-gutter)); |
177 | | - } |
178 | | - |
179 | | - .Layout-main-centered-xl { |
180 | | - max-width: calc(#{$container-xl} + var(--Layout-sidebar-width) + var(--Layout-gutter)); |
181 | | - } |
182 | | -} |
| 1 | +@import '@primer/view-components/app/components/primer/alpha/layout'; |
0 commit comments