Skip to content
Open
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
39 changes: 17 additions & 22 deletions src/components/main-nav.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from 'react';
import {styled} from 'styletron-react';
import Helmet from 'react-helmet';
import Link from 'gatsby-link';
import {MainNavContainer, MainNavItem, SearchField} from './styled-elements';
import {getPath} from '../utils';
import React from "react";
import { styled } from "styletron-react";
import Helmet from "react-helmet";
import Link from "gatsby-link";
import { MainNavContainer, MainNavItem, SearchField } from "./styled-elements";
import { getPath } from "../utils";

const InternalLink = props => {
return <Link style={{backgroundColor: 'transparent'}} {...props} />;
return <Link style={{ backgroundColor: "transparent" }} {...props} />;
};

const ExternalLink = styled('a', ({styleProps = {}}) => ({
backgroundColor: 'transparent',
...styleProps.overrides,
const ExternalLink = styled("a", ({ styleProps = {} }) => ({
backgroundColor: "transparent",
...styleProps.overrides
}));

class DocsSearch extends React.Component {
Expand All @@ -20,10 +20,10 @@ class DocsSearch extends React.Component {
<SearchField
styleProps={{
overrides: {
'@media (max-width: 355px)': {
display: 'none',
},
},
"@media (max-width: 355px)": {
display: "none"
}
}
}}
placeholder="Search"
id="search-field"
Expand All @@ -33,7 +33,7 @@ class DocsSearch extends React.Component {
}

const Nav = props => {
const {data, location, pathPrefix} = props;
const { data, location, pathPrefix } = props;

function matchPath(regexp) {
return location.pathname.match(regexp);
Expand Down Expand Up @@ -61,19 +61,14 @@ const Nav = props => {
title={item.title}
/>
) : null}
<MainNavItem styleProps={{isActive}}>{item.title}</MainNavItem>
<MainNavItem styleProps={{ isActive }}>{item.title}</MainNavItem>
</InternalLink>
);
})}
<InternalLink to="/support">
<MainNavItem
styleProps={{
isActive: isActive('/support'),
overrides: {
'@media (max-width: 474px)': {
display: 'none',
},
},
isActive: isActive("/support")
}}
>
Support
Expand Down
175 changes: 90 additions & 85 deletions src/components/styled-elements.js
Original file line number Diff line number Diff line change
@@ -1,125 +1,130 @@
const React = require('react');
const {styled} = require('styletron-react');
const React = require("react");
const { styled } = require("styletron-react");
const {
primaryColor,
whiteColor,
blackColor,
black90Color,
white120Color,
fontFamily,
} = require('./style-settings');
fontFamily
} = require("./style-settings");

exports.MainNavContainer = styled('div', {});
exports.MainNavContainer = styled("div", {});

exports.SearchField = styled('input', ({styleProps = {}}) => ({
boxSizing: 'border-box',
display: 'inline-block',
exports.SearchField = styled("input", ({ styleProps = {} }) => ({
boxSizing: "border-box",
display: "inline-block",
fontFamily: fontFamily,
fontSize: '14px',
fontWeight: 'normal',
lineHeight: '18px',
fontSize: "14px",
fontWeight: "normal",
lineHeight: "18px",
color: white120Color,
width: '90px',
height: '100%',
border: 'none',
borderRadius: '2px',
backgroundColor: 'transparent',
outline: 'none',
verticalAlign: 'baseline',
transition: 'width .3s',
padding: '7px 12px',
'::placeholder': {
width: "90px",
height: "100%",
border: "none",
borderRadius: "2px",
backgroundColor: "transparent",
outline: "none",
verticalAlign: "baseline",
transition: "width .3s",
padding: "7px 15px",
"::placeholder": {
opacity: 1,
color: white120Color,
fontFamily: fontFamily,
fontWeight: 'bold',
fontSize: '11px',
letterSpacing: '2px',
textTransform: 'uppercase',
fontWeight: "bold",
fontSize: "11px",
letterSpacing: "2px",
textTransform: "uppercase"
},
':focus': {
width: '120px',
":focus": {
width: "120px",
color: blackColor,
backgroundColor: 'rgba(250, 250, 250, 1)',
backgroundColor: "rgba(250, 250, 250, 1)"
},
...styleProps.overrides,
...styleProps.overrides
}));

exports.MainNavItem = styled('span', ({styleProps = {}}) => ({
display: 'inline-block',
exports.MainNavItem = styled("span", ({ styleProps = {} }) => ({
display: "inline-block",
fontFamily: fontFamily,
fontWeight: 'bold',
fontSize: '11px',
letterSpacing: '2px',
textTransform: 'uppercase',
textDecoration: 'none',
lineHeight: '1',
padding: '17px 15px 19px 15px',
borderTopWidth: '4px',
borderTopStyle: 'solid',
fontWeight: "bold",
fontSize: "11px",
letterSpacing: "2px",
textTransform: "uppercase",
textDecoration: "none",
lineHeight: "1",
padding: "17px 15px 19px 15px",
borderTopWidth: "4px",
borderTopStyle: "solid",
color: styleProps.isActive ? whiteColor : white120Color,
borderTopColor: styleProps.isActive ? primaryColor : 'transparent',
':hover': {
color: whiteColor,
borderTopColor: styleProps.isActive ? primaryColor : "transparent",
":hover": {
color: whiteColor
},
'@media (max-width: 380px)': {
padding: '17px 8px 19px 8px',
"@media (max-width: 380px)": {
padding: "17px 8px 19px 8px"
},
'@media (max-width: 348px)': {
padding: '17px 4px 19px 4px',
letterSpacing: '1px',
"@media (max-width: 348px)": {
padding: "17px 4px 19px 4px",
letterSpacing: "1px"
},
...styleProps.overrides,
"@media (max-width: 624px)": {
float: "none",
display: "block",
textAlign: "left"
},
...styleProps.overrides
}));

exports.SideNavContainer = styled('div', ({styleProps = {}}) => ({
position: 'relative',
width: '310px',
paddingRight: '24px',
paddingTop: '24px',
paddingBottom: '28px',
listStyle: 'none',
'@media (max-width: 374px)': {
':hover': {
width: '100%',
boxSizing: 'border-box',
},
exports.SideNavContainer = styled("div", ({ styleProps = {} }) => ({
position: "relative",
width: "310px",
paddingRight: "24px",
paddingTop: "24px",
paddingBottom: "28px",
listStyle: "none",
"@media (max-width: 374px)": {
":hover": {
width: "100%",
boxSizing: "border-box"
}
},
...styleProps.overrides,
...styleProps.overrides
}));

exports.SideNavUl = styled('ul', ({styleProps = {}}) => ({
margin: '0',
listStyle: 'none',
...styleProps.overrides,
exports.SideNavUl = styled("ul", ({ styleProps = {} }) => ({
margin: "0",
listStyle: "none",
...styleProps.overrides
}));

exports.SideNavLi = styled('li', ({styleProps = {}}) => ({
margin: '0',
...styleProps.overrides,
exports.SideNavLi = styled("li", ({ styleProps = {} }) => ({
margin: "0",
...styleProps.overrides
}));

exports.SideNavItem = styled('span', ({styleProps = {}}) => ({
display: 'inline-block',
padding: '5px 11px',
fontSize: '16px',
fontWeight: styleProps.isActive ? 'bold' : '400',
borderLeft: '4px solid transparent',
exports.SideNavItem = styled("span", ({ styleProps = {} }) => ({
display: "inline-block",
padding: "5px 11px",
fontSize: "16px",
fontWeight: styleProps.isActive ? "bold" : "400",
borderLeft: "4px solid transparent",
color: styleProps.isActive ? blackColor : white120Color,
':hover': styleProps.noLink
":hover": styleProps.noLink
? {}
: {
color: styleProps.isActive ? blackColor : primaryColor,
fontWeight: 'bold',
fontWeight: "bold"
},
':before': {
":before": {
content: '""',
display: 'inline-block',
position: 'absolute',
left: '0',
height: '28px',
borderLeft: '4px solid transparent',
borderLeftColor: styleProps.isActive ? primaryColor : 'transparent',
display: "inline-block",
position: "absolute",
left: "0",
height: "28px",
borderLeft: "4px solid transparent",
borderLeftColor: styleProps.isActive ? primaryColor : "transparent"
},
...styleProps.overrides,
...styleProps.overrides
}));
Loading