Skip to content

Commit e7cbb5f

Browse files
committed
refactor: major cleanup + simplification of tabs and panel UI styles based on testing
1 parent e1d87ff commit e7cbb5f

File tree

2 files changed

+27
-115
lines changed

2 files changed

+27
-115
lines changed

packages/uikit-workshop/src/sass/scss/04-components/_pattern-info.scss

Lines changed: 23 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -8,42 +8,31 @@
88
* code, annotations, and more.
99
*/
1010
.pl-c-pattern-info {
11-
@media all and (min-width: $pl-bp-large) {
12-
display: flex;
13-
}
11+
flex-grow: 1; // fills space available when placed in the parent flex container
12+
display: flex;
13+
flex-direction: row;
14+
flex-flow: row wrap;
15+
width: 100%;
16+
overflow: auto;
17+
-webkit-overflow-scrolling: touch;
1418

1519
/**
1620
* Pattern info inside the "view all" template
1721
*/
1822
.pl-c-pattern & {
1923
max-height: 20rem;
24+
min-height: 18rem;
2025
overflow: scroll;
2126
@include hideScrollBar();
27+
display: flex;
28+
-webkit-overflow-scrolling: touch;
2229

2330
@media all and (min-width: $pl-bp-large) {
2431
max-height: none;
2532
height: 18rem;
2633
overflow: visible;
2734
}
2835
}
29-
30-
/**
31-
* Pattern info inside modal
32-
*/
33-
.pl-c-modal & {
34-
position: absolute;
35-
top: 0;
36-
right: 0;
37-
bottom: 0;
38-
left: 0;
39-
overflow: scroll;
40-
@include hideScrollBar();
41-
42-
@media all and (min-width: $pl-bp-large) {
43-
position: static;
44-
overflow: visible;
45-
}
46-
}
4736
}
4837

4938
/**
@@ -52,68 +41,19 @@
5241
* Right side contains pattern code
5342
*/
5443
.pl-c-pattern-info__panel {
55-
padding: 1rem;
56-
57-
@media all and (min-width: $pl-bp-med) {
58-
padding-right: 2.3rem;
59-
}
60-
61-
@media all and (min-width: $pl-bp-large) {
62-
flex: auto;
63-
position: absolute;
64-
top: 0;
65-
bottom: 0;
66-
left: 0;
67-
right: 1.3rem;
68-
padding-right: 0;
69-
}
70-
71-
.pl-c-modal & {
72-
@media all and (min-width: $pl-bp-xl) {
73-
right: 0;
74-
padding-left: 2rem;
75-
padding-right: 2.5rem;
76-
}
77-
}
78-
}
79-
80-
/**
81-
* Pattern Info Panel
82-
* 1) Left panel that contains pattern title, lineage, description, annotations
83-
*/
84-
.pl-c-pattern-info__panel--info {
85-
padding-top: 2rem;
86-
87-
@media all and (min-width: $pl-bp-large) {
88-
left: 0;
89-
right: 50%;
90-
overflow: scroll;
91-
@include hideScrollBar();
92-
}
93-
94-
@media all and (min-width: $pl-bp-xl) {
95-
right: 55%;
96-
}
97-
}
98-
99-
/**
100-
* Pattern Code Panel
101-
* 1) Right panel that displays the pattern's code (found in _tabs.scss)
102-
* 2) Using a sibling selector because the pattern info isn't always present.
103-
* The sibling selector allows the code panel to occupy the full width of
104-
* the modal
105-
* 1) Cap the height of the code panel in the modal
106-
*/
107-
.pl-c-pattern-info__panel--info + .pl-c-pattern-info__panel--code {
108-
@media all and (min-width: $pl-bp-large) {
109-
right: 0;
110-
left: 50%;
111-
top: 1.2rem;
112-
}
113-
114-
@media all and (min-width: $pl-bp-xl) {
115-
left: 45%;
116-
}
44+
flex-basis: 40%; // fills up 100% if only one panel exists. using 40% vs 50% due to quirky behavior in IE 11
45+
padding-top: 1rem;
46+
padding-right: 1rem;
47+
padding-bottom: 0;
48+
padding-left: 1rem;
49+
margin-bottom: 1rem;
50+
flex-grow: 1;
51+
max-width: 100%;
52+
min-width: 300px; // so panels stack automatically
53+
display: inline-flex;
54+
flex-direction: column;
55+
overflow: auto;
56+
-webkit-overflow-scrolling: touch;
11757
}
11858

11959
/**

packages/uikit-workshop/src/sass/scss/04-components/_tabs.scss

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,7 @@
1717
display: flex;
1818
flex-direction: column;
1919
overflow: hidden;
20-
21-
/**
22-
* Tabs inside a code panel
23-
*/
24-
.pl-c-pattern-info__panel--code & {
25-
@media all and (min-width: $pl-bp-large) {
26-
position: absolute;
27-
top: 1rem;
28-
bottom: 1rem;
29-
left: 1rem;
30-
right: 1rem;
31-
}
32-
}
33-
34-
.pl-c-modal & {
35-
@media all and (min-width: $pl-bp-xl) {
36-
right: 2.5rem;
37-
left: 2rem;
38-
}
39-
}
20+
flex-grow: 1;
4021
}
4122

4223
/**
@@ -89,18 +70,9 @@
8970
* 1) Tab content contains the tab panels
9071
*/
9172
.pl-c-tabs__content {
92-
flex: 1 0 auto;
93-
overflow: scroll;
94-
@include hideScrollBar();
95-
height: 100%;
73+
overflow: auto;
74+
-webkit-overflow-scrolling: touch;
9675
padding-top: 0.5rem;
97-
98-
/**
99-
* Tab content inside modal
100-
*/
101-
.pl-c-modal & {
102-
border: 0;
103-
}
10476
}
10577

10678
/**
@@ -110,7 +82,7 @@
11082
*/
11183
.pl-c-tabs__panel {
11284
display: none;
113-
min-height: 12rem;
85+
// min-height: 12rem;
11486

11587
&.pl-is-active-tab {
11688
display: block;

0 commit comments

Comments
 (0)