Skip to content

Commit

Permalink
Hide dropdown on the homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
domyen committed Jun 14, 2018
1 parent 294d599 commit ec7fd0f
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 64 deletions.
129 changes: 67 additions & 62 deletions src/components/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const GitHubWrapper = styled.div`
}
`;

export default function Header({ githubUrl, inverse, firstChapter, ...props }) {
export default function Header({ githubUrl, inverse, firstChapter, isHome, ...props }) {
const [namespace, repo] = githubUrl.match(/github.com\/(.*)\/(.*)$/).slice(1);
return (
<NavWrapper {...props}>
Expand All @@ -157,69 +157,72 @@ export default function Header({ githubUrl, inverse, firstChapter, ...props }) {
</NavItem>
</NavGroup>
<NavGroup right>
<NavItem showDesktop>
<WithTooltip
placement="top"
mode="click"
closeOnClick
tooltip={
<TooltipList>
<TooltipItem>
<ViewLayerImage src="/logo-react.svg" alt="React" />
<Meta>
<Title>React</Title>
<Detail>
<LanguageLink
className="tertiary"
isGatsby
to={`/react/en/${firstChapter}/`}
>
English
</LanguageLink>
<LanguageLink
className="tertiary"
isGatsby
to={`/react/es/${firstChapter}/`}
>
Español
</LanguageLink>
</Detail>
</Meta>
</TooltipItem>
<TooltipItem>
<ViewLayerImage src="/logo-vue.svg" alt="Vue" />
<Meta>
<Title>Vue</Title>
<Detail>
{/* <LanguageLink className="tertiary" isGatsby to={`/vue/en/${firstChapter}/`}>
{!isHome && (
<NavItem showDesktop>
<WithTooltip
placement="top"
mode="click"
closeOnClick
tooltip={
<TooltipList>
<TooltipItem>
<ViewLayerImage src="/logo-react.svg" alt="React" />
<Meta>
<Title>React</Title>
<Detail>
<LanguageLink
className="tertiary"
isGatsby
to={`/react/en/${firstChapter}/`}
>
English
</LanguageLink>
<LanguageLink
className="tertiary"
isGatsby
to={`/react/es/${firstChapter}/`}
>
Español
</LanguageLink>
</Detail>
</Meta>
</TooltipItem>
<TooltipItem>
<ViewLayerImage src="/logo-vue.svg" alt="Vue" />
<Meta>
<Title>Vue</Title>
<Detail>
{/* <LanguageLink className="tertiary" isGatsby to={`/vue/en/${firstChapter}/`}>
English
</LanguageLink> */}
<LanguageLink className="tertiary" isGatsby to="/react/en/contribute">
Contributors wanted
</LanguageLink>
</Detail>
</Meta>
</TooltipItem>
<TooltipItem>
<ViewLayerImage src="/logo-angular.svg" alt="Angular" />
<Meta>
<Title>Angular</Title>
<Detail>
<LanguageLink className="tertiary" isGatsby to="/react/en/contribute">
Contributors wanted
</LanguageLink>
</Detail>
</Meta>
</TooltipItem>
</TooltipList>
}
>
<NavLink className={inverse ? 'inverse' : 'tertiary'}>
<Icon icon="switchalt" />
React
</NavLink>
</WithTooltip>
</NavItem>
<LanguageLink className="tertiary" isGatsby to="/react/en/contribute">
Contributors wanted
</LanguageLink>
</Detail>
</Meta>
</TooltipItem>
<TooltipItem>
<ViewLayerImage src="/logo-angular.svg" alt="Angular" />
<Meta>
<Title>Angular</Title>
<Detail>
<LanguageLink className="tertiary" isGatsby to="/react/en/contribute">
Contributors wanted
</LanguageLink>
</Detail>
</Meta>
</TooltipItem>
</TooltipList>
}
>
<NavLink className={inverse ? 'inverse' : 'tertiary'}>
<Icon icon="switchalt" />
React
</NavLink>
</WithTooltip>
</NavItem>
)}

<NavItem>
<GitHubWrapper>
<GitHubButton type="stargazers" namespace={namespace} repo={repo} />
Expand All @@ -235,9 +238,11 @@ Header.propTypes = {
githubUrl: PropTypes.string,
inverse: PropTypes.bool,
firstChapter: PropTypes.string.isRequired,
isHome: PropTypes.bool,
};

Header.defaultProps = {
githubUrl: null,
inverse: false,
isHome: null,
};
4 changes: 2 additions & 2 deletions src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ injectGlobalStyles();

const HeaderWrapper = styled(Header)`
${props =>
props.home &&
props.isHome &&
css`
position: absolute;
left: 0;
Expand Down Expand Up @@ -50,7 +50,7 @@ const TemplateWrapper = ({
title={title}
githubUrl={githubUrl}
inverse={pathname === '/'}
home={pathname === '/'}
isHome={pathname === '/'}
firstChapter={toc[0]}
/>

Expand Down

0 comments on commit ec7fd0f

Please sign in to comment.