Skip to content

Commit 903755e

Browse files
Merge pull request #5818 from topcoder-platform/contentful-tabs-mobile
Contentful tabs mobile
2 parents d4fa135 + 08a86ec commit 903755e

File tree

5 files changed

+59
-6
lines changed

5 files changed

+59
-6
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ workflows:
342342
filters:
343343
branches:
344344
only:
345-
- develop
345+
- free
346346
# This is alternate dev env for parallel testing
347347
- "build-test":
348348
context : org-global
@@ -363,7 +363,7 @@ workflows:
363363
filters:
364364
branches:
365365
only:
366-
- thrive-spooky1-p0-2
366+
- free
367367
# This is stage env for production QA releases
368368
- "build-prod-staging":
369369
context : org-global

src/shared/components/Contentful/Tabs/Tabs.jsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ export default class TabsItemsLoader extends Component {
8787
theme,
8888
tabId,
8989
themeName,
90+
forceRenderTabPanel,
9091
} = this.props;
9192
const { tabIndex, mobileTabsShow } = this.state;
9293

@@ -102,7 +103,7 @@ export default class TabsItemsLoader extends Component {
102103
selectedIndex={tabIndex}
103104
selectedTabClassName={theme.selected}
104105
onSelect={tIndx => this.setState({ tabIndex: tIndx, mobileTabsShow: false })}
105-
forceRenderTabPanel
106+
forceRenderTabPanel={forceRenderTabPanel}
106107
>
107108
<div className={theme.tabListWrap}>
108109
{
@@ -230,6 +231,7 @@ TabsItemsLoader.defaultProps = {
230231
selected: 0,
231232
spaceName: null,
232233
environment: null,
234+
forceRenderTabPanel: true,
233235
};
234236

235237
TabsItemsLoader.propTypes = {
@@ -241,4 +243,5 @@ TabsItemsLoader.propTypes = {
241243
theme: PT.shape().isRequired,
242244
tabId: PT.string.isRequired,
243245
themeName: PT.string.isRequired,
246+
forceRenderTabPanel: PT.bool,
244247
};

src/shared/components/Contentful/Tabs/index.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function ContentfulTabs(props) {
3636
theme={TAB_THEMES[fields.theme || 'Default']}
3737
tabId={fields.urlQueryName || id}
3838
themeName={fields.theme}
39+
forceRenderTabPanel={fields.forceRenderTabPanel}
3940
/>
4041
);
4142
}}

src/shared/components/Contentful/Tabs/themes/pills.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ $text-color-black: #262628;
2222
border-bottom: none;
2323

2424
@include xs-to-sm {
25-
-webkit-flex-direction: column; /* Safari */
26-
flex-direction: column;
25+
overflow: auto;
2726
align-items: center;
27+
justify-content: flex-start;
2828
}
2929
}
3030

@@ -38,9 +38,11 @@ $text-color-black: #262628;
3838
cursor: pointer;
3939
border-radius: 15px;
4040
padding: 0 15px;
41+
white-space: nowrap;
4142

4243
@include xs-to-sm {
4344
margin: 2px;
45+
padding: 0 25px;
4446
}
4547

4648
&:hover {

src/shared/components/Contentful/Tabs/themes/vertical.scss

+48-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* stylelint-disable no-descending-specificity */
12
@import '~styles/mixins';
23

34
$text-color-black: #262628;
@@ -11,6 +12,10 @@ $gray-border-color: #e9e9e9;
1112
display: flex;
1213
max-width: $screen-lg;
1314
margin: auto;
15+
16+
@media (max-width: 768px) {
17+
flex-direction: column;
18+
}
1419
}
1520

1621
.tablist {
@@ -24,9 +29,18 @@ $gray-border-color: #e9e9e9;
2429
border-right: 5px solid $gray-border-color;
2530
margin-right: 58px;
2631
padding: 7px 0;
32+
33+
@media (max-width: 768px) {
34+
flex-direction: row;
35+
border-right: none;
36+
margin-right: 0;
37+
margin-bottom: 15px;
38+
overflow: auto;
39+
padding: 0;
40+
}
2741
}
2842

29-
.tab {
43+
li.tab {
3044
text-align: left;
3145
color: $text-color-black;
3246
font-size: 16px;
@@ -35,6 +49,16 @@ $gray-border-color: #e9e9e9;
3549
cursor: pointer;
3650
padding-right: 30px;
3751

52+
@media (max-width: 768px) {
53+
padding-right: 20px;
54+
border-bottom: 5px solid $gray-border-color;
55+
min-width: auto !important;
56+
57+
&:first-child {
58+
padding-left: 7px;
59+
}
60+
}
61+
3862
&:hover,
3963
&.selected {
4064
font-weight: 700;
@@ -52,6 +76,29 @@ $gray-border-color: #e9e9e9;
5276
border-radius: 5px;
5377
border-top: 1px solid white;
5478
border-bottom: 1px solid white;
79+
80+
@media (max-width: 768px) {
81+
display: none;
82+
}
83+
}
84+
85+
p {
86+
position: relative;
87+
display: inline-block;
88+
89+
&::after {
90+
@media (max-width: 768px) {
91+
content: '';
92+
background: $selected-color;
93+
height: 5px;
94+
width: 100%;
95+
display: flex;
96+
position: absolute;
97+
border-radius: 15%;
98+
border-left: 2px solid white;
99+
border-right: 2px solid white;
100+
}
101+
}
55102
}
56103
}
57104

0 commit comments

Comments
 (0)