Skip to content

New tabs theme #5621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ workflows:
filters:
branches:
only:
- free
- new-tabs-theme
# This is stage env for production QA releases
- "build-prod-staging":
context : org-global
Expand Down
39 changes: 36 additions & 3 deletions src/shared/components/Contentful/Tabs/Tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import underlineTheme from './themes/underline.scss';
import underlineDarkTheme from './themes/underline-dark.scss';
import verticalTheme from './themes/vertical.scss';
import pillsTheme from './themes/pills.scss';
import underlineBoxTheme from './themes/underline-box.scss';

export const TAB_THEMES = {
Default: defaultTheme,
Expand All @@ -36,13 +37,15 @@ export const TAB_THEMES = {
'Underline dark': underlineDarkTheme,
Vertical: verticalTheme,
Pills: pillsTheme,
'Underline box': underlineBoxTheme,
};

export default class TabsItemsLoader extends Component {
constructor(props) {
super(props);
this.state = {
tabIndex: props.selected || 0,
mobileTabsShow: false,
};

this.updatePageUrl.bind(this);
Expand Down Expand Up @@ -83,8 +86,9 @@ export default class TabsItemsLoader extends Component {
environment,
theme,
tabId,
themeName,
} = this.props;
const { tabIndex } = this.state;
const { tabIndex, mobileTabsShow } = this.state;

return (
<ContentfulLoader
Expand All @@ -97,11 +101,39 @@ export default class TabsItemsLoader extends Component {
className={theme.container}
selectedIndex={tabIndex}
selectedTabClassName={theme.selected}
onSelect={tIndx => this.setState({ tabIndex: tIndx })}
onSelect={tIndx => this.setState({ tabIndex: tIndx, mobileTabsShow: false })}
forceRenderTabPanel
>
<div className={theme.tabListWrap}>
<TabList className={theme.tablist}>
{
themeName === 'Underline box' ? (
<button type="button" className={theme.tabListMobileTrigger} onClick={() => this.setState({ mobileTabsShow: !mobileTabsShow })}>
<MarkdownRenderer
markdown={_.toArray(data.entries.items)[tabIndex].fields.tab}
/>
<svg className={mobileTabsShow ? theme.tabListMobileTriggerSVGOpen : theme.tabListMobileTriggerSVG} width="16px" height="10px" viewBox="0 0 16 10" version="1.1" xmlns="http://www.w3.org/2000/svg">
<defs>
<polygon id="path-1" points="7.7 9.2 0 1.5 1.4 0 7.7 6.3 14 0 15.4 1.5" />
</defs>
<g id="Mobile" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g id="01" transform="translate(-228.000000, -315.000000)">
<g id="Group-6" transform="translate(16.000000, 289.000000)">
<g id="Group-4" transform="translate(126.000000, 21.000000)">
<g id="icons/arrow/minimal-down" transform="translate(86.300000, 5.400000)">
<mask id="mask-2" fill="white">
<use xlinkHref="#path-1" />
</mask>
<use id="icon-color" fill="#2A2A2A" xlinkHref="#path-1" />
</g>
</g>
</g>
</g>
</g>
</svg>
</button>
) : null
}
<TabList className={[theme.tablist, mobileTabsShow ? theme.visible : null]}>
{
_.map(data.entries.items, tabItem => (
<Tab
Expand Down Expand Up @@ -208,4 +240,5 @@ TabsItemsLoader.propTypes = {
selected: PT.number,
theme: PT.shape().isRequired,
tabId: PT.string.isRequired,
themeName: PT.string.isRequired,
};
1 change: 1 addition & 0 deletions src/shared/components/Contentful/Tabs/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function ContentfulTabs(props) {
selected={fields.selected}
theme={TAB_THEMES[fields.theme || 'Default']}
tabId={fields.urlQueryName || id}
themeName={fields.theme}
/>
);
}}
Expand Down
168 changes: 168 additions & 0 deletions src/shared/components/Contentful/Tabs/themes/underline-box.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
@import "~styles/mixins";

$container-background-gray: #ebebeb;
$text-color-black: #262628;
$text-color-gray: #888894;
$text-color-pannel: #4a4a4a;

.container {
margin: auto;

@include xs-to-sm {
margin-top: 65px;
}
}

.tabListWrap {
display: flex;
justify-content: center;
position: relative;

.tablist {
@include roboto-regular;

display: flex;
flex-direction: row;
justify-content: center;
list-style-type: none;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
margin: auto;
min-height: 60px;
border-radius: 30px;
align-items: center;
background-color: white;
padding: 0 25px;
border: 1px solid #e4e4e4;

@include xs-to-sm {
white-space: nowrap;
flex-direction: column;
padding: 28px 15px 0;
align-items: flex-start;
border-radius: 8px;
min-width: 85vw;
overflow: visible;
position: absolute;
z-index: 999;
display: none; // by default

&.visible {
display: flex;
}
}
}

.tabListMobileTrigger {
display: none;
justify-content: center;
align-items: center;
background-color: white;
position: absolute;
top: -65px;
width: 85vw;
left: calc(50% - 42.5vw);
outline: none;
border: navajowhite;
min-height: 60px;
font-family: Barlow, sans-serif;
font-size: 16px;
font-weight: 600;
text-transform: uppercase;
border-radius: 30px;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
color: #2a2a2a;

@media (max-width: 768px) {
display: flex;
}

.tabListMobileTriggerSVG,
.tabListMobileTriggerSVGOpen {
margin-left: 9px;
}

.tabListMobileTriggerSVGOpen {
transform: scaleY(-1);
}
}
}

.tab {
text-align: center;
margin: 0 25px;
color: #555;
font-family: Barlow, sans-serif;
font-size: 16px;
font-weight: 600;
line-height: 20px;
padding-bottom: 5px;
cursor: pointer;
margin-bottom: -5px;
position: relative;

@include xs-to-sm {
margin: 0;
margin-bottom: 23px;
padding: 0;
padding-left: 5px;

&::after {
display: none;
}

&:hover,
&.selected {
border-left: 3px solid #43d7b0;
margin-left: -3px;
}
}

&:hover,
&.selected {
color: #2a2a2a;

&::after {
content: '';
border-radius: 1000vw;
background: #43d7b0;
height: 3px;
width: 15px;
position: absolute;
bottom: 0;
left: calc(50% - 7px);
border-left: 1px solid #fff;
border-right: 1px solid #fff;

@include xs-to-sm {
width: calc(100% - 36px);
bottom: -5px;
}
}
}

p {
small {
color: #888894;
font-size: 13px;
font-weight: 400;
line-height: 25px;
text-align: left;
}

strong {
font-weight: bold;
}
}
}

.tabpannel {
display: none;
}

.selectedTabPanel {
display: block;

@include xs-to-sm {
padding: 0 15px;
}
}
1 change: 1 addition & 0 deletions src/shared/components/Gigs/GigApply/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
margin-left: 20px;
}
}

.gig-list-btn {
margin-right: 12px;
}
Expand Down