-
Notifications
You must be signed in to change notification settings - Fork 206
Expand file tree
/
Copy path_patterns_equal-height-row.scss
More file actions
175 lines (151 loc) · 5.48 KB
/
Copy path_patterns_equal-height-row.scss
File metadata and controls
175 lines (151 loc) · 5.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/*
@classreference
equal-height-row:
Equal height row:
.p-equal-height-row:
Main element of the equal height row component.
"&.has-divider-1":
Cross-column divider shown between the first and second grid rows.
"&.has-divider-2":
Cross-column divider shown between the second and third grid rows.
"&.has-divider-3":
Cross-column divider shown between the third and fourth grid rows.
.p-equal-height-row--wrap:
Wraps contents such that two items appear per row on medium screen sizes.
Column:
.p-equal-height-row__col:
Column element within an equal height row.
.p-equal-height-row__col.is-borderless:
Column element within an equal height row with no top border.
Item:
.p-equal-height-row__item:
Item element within an equal height row column.
*/
@use 'sass:math';
@import 'settings';
@mixin vf-p-equal-height-row {
.p-equal-height-row,
.p-equal-height-row--wrap {
@extend %vf-grid-row;
position: relative;
.p-equal-height-row__col {
// At smaller sizes, each column will have top border by default
border-top-color: $colors--theme--border-low-contrast;
border-top-style: solid;
border-top-width: 1px;
display: grid;
grid-column: span $grid-8-columns-small;
grid-row: span 4;
grid-template-rows: subgrid;
margin-bottom: $spv--small;
position: relative;
@media screen and ($breakpoint-small <= width < $breakpoint-large) {
grid-column: span $grid-8-columns-medium;
grid-template-columns: subgrid;
// At medium size, each column item will take half of the available
// cols from the parent grid
.p-equal-height-row__item {
grid-column: span calc($grid-8-columns-medium / 2);
}
// At medium size, position the first column item on the left of the
// grid
.p-equal-height-row__item:first-child {
// This needs to be sufficiently large so remaining column items won't
// get stretched
grid-row: span 100;
}
}
@media screen and (width >= $breakpoint-large) {
border: none;
grid-column: span calc($grid-8-columns / 4);
margin-bottom: 0;
}
}
.p-equal-height-row__col.is-borderless {
border: none;
}
// DIVIDERS
// For each row or column grid we only have access to two pseudo elements:
// If 1st-divider (::before) is present, assume 2nd-divider (::after) isn't, then 3rd-divider must be (::after)
// If 2nd-divider (::after) is present, assume 1st-divider (::before) isn't, then 3rd-divider must be (::before)
&.has-divider-1::before,
&.has-divider-2::after,
&.has-divider-3:not(.has-divider-1)::before,
&.has-divider-3:not(.has-divider-2)::after {
@extend %vf-pseudo-border;
// Override border color to be low contrast
background-color: $colors--theme--border-low-contrast;
// Row-level dividers are not visible on smaller screen sizes
display: none;
grid-column-end: span $grid-8-columns;
grid-column-start: 1;
margin: auto;
@media screen and (width >= $breakpoint-large) {
display: block;
}
}
&.has-divider-1::before {
grid-row: 2;
}
&.has-divider-2::after {
grid-row: 3;
}
// When 3rd-divider is present and 1st-divider is not present
&.has-divider-3:not(.has-divider-1)::before,
// When 3rd-divider is present and 2nd-divider is not present
&.has-divider-3:not(.has-divider-2)::after,
// When only 3rd-divider is present
&.has-divider-3:not(.has-divider-1):not(.has-divider-2)::before {
grid-row: 4;
}
&.has-divider-3:not(.has-divider-1):not(.has-divider-2)::after {
display: none;
}
}
// WRAP VARIANT
// This variant displays multiple columns side-by-side and wraps them at
// medium size; we have to unset some grid properties from the default
// variant to enable this functionality
.p-equal-height-row--wrap {
.p-equal-height-row__col {
@media screen and ($breakpoint-small <= width < $breakpoint-large) {
// Fit 2 columns onto each row at medium size
grid-column: span calc($grid-8-columns-medium / 2);
grid-template-columns: none;
.p-equal-height-row__item {
grid-column: auto;
}
.p-equal-height-row__item:first-child {
grid-row: auto;
}
}
}
}
// ADVANCED GRID SUPPORT
// Support for 25-75 split on large screen size
// TODO implement with new 4/4/8 grid (.grid-row)
// TODO this may be a breaking change. we are applying new grid column counts to the old row class, in order to migrate the entire component to the new grid.
// This needs to be carefully investigated. It may require a major version update.
.grid-row--25-75-on-large > .grid-col,
.grid-row > .grid-col-6,
.row--25-75-on-large > .col,
.row > .col-9 {
& .p-equal-height-row,
& .p-equal-height-row--wrap {
@media screen and (width >= $breakpoint-large) {
grid-template-columns: repeat(#{(math.div($grid-8-columns, 4) * 3)}, minmax(0, 1fr));
}
}
}
.grid-row--50-50-on-large > .grid-col,
.grid-row > .grid-col-4,
.row--50-50-on-large > .col,
.row > .col-6 {
& .p-equal-height-row,
& .p-equal-height-row--wrap {
@media screen and (width >= $breakpoint-large) {
grid-template-columns: repeat(#{math.div($grid-8-columns, 2)}, minmax(0, 1fr));
}
}
}
}