ThemeProvider (#677)

closes #655
This commit is contained in:
Tom Moor
2018-06-09 19:10:30 -07:00
committed by GitHub
parent 0942deec38
commit 434129a434
50 changed files with 277 additions and 324 deletions

View File

@ -2,7 +2,6 @@
import styled from 'styled-components'; import styled from 'styled-components';
import breakpoint from 'styled-components-breakpoint'; import breakpoint from 'styled-components-breakpoint';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import { layout, color } from 'shared/styles/constants';
export const Action = styled(Flex)` export const Action = styled(Flex)`
justify-content: center; justify-content: center;
@ -10,7 +9,7 @@ export const Action = styled(Flex)`
padding: 0 0 0 12px; padding: 0 0 0 12px;
a { a {
color: ${color.text}; color: ${props => props.theme.text};
height: 24px; height: 24px;
} }
`; `;
@ -19,7 +18,7 @@ export const Separator = styled.div`
margin-left: 12px; margin-left: 12px;
width: 1px; width: 1px;
height: 20px; height: 20px;
background: ${color.slateLight}; background: ${props => props.theme.slateLight};
`; `;
const Actions = styled(Flex)` const Actions = styled(Flex)`
@ -38,7 +37,8 @@ const Actions = styled(Flex)`
${breakpoint('tablet')` ${breakpoint('tablet')`
left: auto; left: auto;
padding: ${layout.vpadding} ${layout.hpadding} 8px 8px; padding: ${props => props.theme.vpadding} ${props =>
props.theme.hpadding} 8px 8px;
`}; `};
`; `;

View File

@ -3,7 +3,6 @@ import * as React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
type Props = { type Props = {
children: React.Node, children: React.Node,
@ -31,7 +30,7 @@ const Container = styled(Flex)`
font-size: 14px; font-size: 14px;
line-height: 1; line-height: 1;
background-color: ${({ type }) => color[type]}; background-color: ${({ theme, type }) => theme.color[type]};
`; `;
export default Alert; export default Alert;

View File

@ -3,7 +3,6 @@ import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { observable } from 'mobx'; import { observable } from 'mobx';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { color } from 'shared/styles/constants';
import placeholder from './placeholder.png'; import placeholder from './placeholder.png';
type Props = { type Props = {
@ -38,7 +37,7 @@ const CircleImg = styled.img`
width: ${props => props.size}px; width: ${props => props.size}px;
height: ${props => props.size}px; height: ${props => props.size}px;
border-radius: 50%; border-radius: 50%;
border: 2px solid ${color.white}; border: 2px solid ${props => props.theme.white};
flex-shrink: 0; flex-shrink: 0;
`; `;

View File

@ -1,7 +1,6 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
import { darken } from 'polished'; import { darken } from 'polished';
const RealButton = styled.button` const RealButton = styled.button`
@ -9,8 +8,8 @@ const RealButton = styled.button`
margin: 0; margin: 0;
padding: 0; padding: 0;
border: 0; border: 0;
background: ${color.primary}; background: ${props => props.theme.primary};
color: ${color.white}; color: ${props => props.theme.white};
border-radius: 4px; border-radius: 4px;
font-size: 15px; font-size: 15px;
height: 36px; height: 36px;
@ -24,7 +23,7 @@ const RealButton = styled.button`
border: 0; border: 0;
} }
&:hover { &:hover {
background: ${darken(0.05, color.primary)}; background: ${props => darken(0.05, props.theme.primary)};
} }
svg { svg {
@ -40,30 +39,30 @@ const RealButton = styled.button`
${props => ${props =>
props.light && props.light &&
` `
color: ${color.slate}; color: ${props.theme.slate};
background: transparent; background: transparent;
border: 1px solid ${color.slate}; border: 1px solid ${props.theme.slate};
&:hover { &:hover {
background: transparent; background: transparent;
color: ${color.slateDark}; color: ${props.theme.slateDark};
border: 1px solid ${color.slateDark}; border: 1px solid ${props.theme.slateDark};
} }
`} ${props => `} ${props =>
props.neutral && props.neutral &&
` `
background: ${color.slate}; background: ${props.theme.slate};
&:hover { &:hover {
background: ${darken(0.05, color.slate)}; background: ${darken(0.05, props.theme.slate)};
} }
`} ${props => `} ${props =>
props.danger && props.danger &&
` `
background: ${color.danger}; background: ${props.theme.danger};
&:hover { &:hover {
background: ${darken(0.05, color.danger)}; background: ${darken(0.05, props.theme.danger)};
} }
`}; `};
`; `;

View File

@ -5,7 +5,6 @@ import { observer } from 'mobx-react';
import styled from 'styled-components'; import styled from 'styled-components';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import { LabelText, Outline } from 'components/Input'; import { LabelText, Outline } from 'components/Input';
import { color, fonts, fontWeight } from 'shared/styles/constants';
import { validateColorHex } from 'shared/utils/color'; import { validateColorHex } from 'shared/utils/color';
const colors = [ const colors = [
@ -165,7 +164,7 @@ const StyledOutline = styled(Outline)`
const HexHash = styled.div` const HexHash = styled.div`
margin-left: 12px; margin-left: 12px;
padding-bottom: 0; padding-bottom: 0;
font-weight: ${fontWeight.medium}; font-weight: 500;
user-select: none; user-select: none;
`; `;
@ -177,13 +176,13 @@ const CustomColorInput = styled.input`
padding-bottom: 0; padding-bottom: 0;
outline: none; outline: none;
background: none; background: none;
font-family: ${fonts.monospace}; font-family: ${props => props.theme.monospaceFontFamily};
font-weight: ${fontWeight.medium}; font-weight: 500;
&::placeholder { &::placeholder {
color: ${color.slate}; color: ${props => props.theme.slate};
font-family: ${fonts.monospace}; font-family: ${props => props.theme.monospaceFontFamily};
font-weight: ${fontWeight.medium}; font-weight: 500;
} }
`; `;

View File

@ -3,8 +3,7 @@ import * as React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import Document from 'models/Document'; import Document from 'models/Document';
import styled from 'styled-components'; import styled, { withTheme } from 'styled-components';
import { color } from 'shared/styles/constants';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import Highlight from 'components/Highlight'; import Highlight from 'components/Highlight';
import { StarredIcon } from 'outline-icons'; import { StarredIcon } from 'outline-icons';
@ -15,11 +14,11 @@ type Props = {
document: Document, document: Document,
highlight?: ?string, highlight?: ?string,
showCollection?: boolean, showCollection?: boolean,
innerRef?: Function, innerRef?: *,
}; };
const StyledStar = styled(({ solid, ...props }) => ( const StyledStar = withTheme(styled(({ solid, theme, ...props }) => (
<StarredIcon color={solid ? color.black : color.text} {...props} /> <StarredIcon color={solid ? theme.black : theme.text} {...props} />
))` ))`
opacity: ${props => (props.solid ? '1 !important' : 0)}; opacity: ${props => (props.solid ? '1 !important' : 0)};
transition: all 100ms ease-in-out; transition: all 100ms ease-in-out;
@ -30,7 +29,7 @@ const StyledStar = styled(({ solid, ...props }) => (
&:active { &:active {
transform: scale(0.95); transform: scale(0.95);
} }
`; `);
const StyledDocumentMenu = styled(DocumentMenu)` const StyledDocumentMenu = styled(DocumentMenu)`
position: absolute; position: absolute;
@ -57,8 +56,8 @@ const DocumentLink = styled(Link)`
&:hover, &:hover,
&:active, &:active,
&:focus { &:focus {
background: ${color.smokeLight}; background: ${props => props.theme.smokeLight};
border: 2px solid ${color.smoke}; border: 2px solid ${props => props.theme.smoke};
outline: none; outline: none;
${StyledStar}, ${StyledDocumentMenu} { ${StyledStar}, ${StyledDocumentMenu} {
@ -71,7 +70,7 @@ const DocumentLink = styled(Link)`
} }
&:focus { &:focus {
border: 2px solid ${color.slateDark}; border: 2px solid ${props => props.theme.slateDark};
} }
`; `;

View File

@ -2,18 +2,18 @@
import * as React from 'react'; import * as React from 'react';
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'; import distanceInWordsToNow from 'date-fns/distance_in_words_to_now';
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
import Collection from 'models/Collection'; import Collection from 'models/Collection';
import Document from 'models/Document'; import Document from 'models/Document';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
const Container = styled(Flex)` const Container = styled(Flex)`
color: ${color.slate}; color: ${props => props.theme.slate};
font-size: 13px; font-size: 13px;
`; `;
const Modified = styled.span` const Modified = styled.span`
color: ${props => (props.highlight ? color.slateDark : color.slate)}; color: ${props =>
props.highlight ? props.theme.slateDark : props.theme.slate};
font-weight: ${props => (props.highlight ? '600' : '400')}; font-weight: ${props => (props.highlight ? '600' : '400')};
`; `;

View File

@ -3,7 +3,6 @@ import * as React from 'react';
import { observable } from 'mobx'; import { observable } from 'mobx';
import { observer, inject } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import { injectGlobal } from 'styled-components'; import { injectGlobal } from 'styled-components';
import { color } from 'shared/styles/constants';
import importFile from 'utils/importFile'; import importFile from 'utils/importFile';
import invariant from 'invariant'; import invariant from 'invariant';
import _ from 'lodash'; import _ from 'lodash';
@ -25,12 +24,12 @@ type Props = {
// eslint-disable-next-line // eslint-disable-next-line
injectGlobal` injectGlobal`
.activeDropZone { .activeDropZone {
background: ${color.slateDark}; background: ${props => props.theme.slateDark};
svg { fill: ${color.white}; } svg { fill: ${props => props.theme.white}; }
} }
.activeDropZone a { .activeDropZone a {
color: ${color.white} !important; color: ${props => props.theme.white} !important;
} }
`; `;

View File

@ -6,7 +6,6 @@ import { observer } from 'mobx-react';
import styled from 'styled-components'; import styled from 'styled-components';
import { PortalWithState } from 'react-portal'; import { PortalWithState } from 'react-portal';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import { color } from 'shared/styles/constants';
import { fadeAndScaleIn } from 'shared/styles/animations'; import { fadeAndScaleIn } from 'shared/styles/animations';
type Props = { type Props = {
@ -90,8 +89,8 @@ const Menu = styled.div`
right: ${({ right }) => right}px; right: ${({ right }) => right}px;
top: ${({ top }) => top}px; top: ${({ top }) => top}px;
z-index: 1000; z-index: 1000;
border: ${color.slateLight}; border: ${props => props.theme.slateLight};
background: ${color.white}; background: ${props => props.theme.white};
border-radius: 2px; border-radius: 2px;
padding: 0.5em 0; padding: 0.5em 0;
min-width: 160px; min-width: 160px;

View File

@ -1,7 +1,6 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
type Props = { type Props = {
onClick?: (SyntheticEvent<*>) => *, onClick?: (SyntheticEvent<*>) => *,
@ -22,7 +21,7 @@ const MenuItem = styled.a`
padding: 6px 12px; padding: 6px 12px;
height: 32px; height: 32px;
color: ${color.slateDark}; color: ${props => props.theme.slateDark};
justify-content: left; justify-content: left;
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
@ -33,11 +32,11 @@ const MenuItem = styled.a`
} }
&:hover { &:hover {
color: ${color.white}; color: ${props => props.theme.white};
background: ${color.primary}; background: ${props => props.theme.primary};
svg { svg {
fill: ${color.white}; fill: ${props => props.theme.white};
} }
} }
`; `;

View File

@ -1,7 +1,6 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
type Props = { type Props = {
children: string, children: string,
@ -14,7 +13,7 @@ const Empty = (props: Props) => {
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
color: ${color.slate}; color: ${props => props.theme.slate};
text-align: center; text-align: center;
`; `;

View File

@ -1,10 +1,9 @@
// @flow // @flow
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
const HelpText = styled.p` const HelpText = styled.p`
margin-top: 0; margin-top: 0;
color: ${color.slateDark}; color: ${props => props.theme.slateDark};
`; `;
export default HelpText; export default HelpText;

View File

@ -2,7 +2,6 @@
import * as React from 'react'; import * as React from 'react';
import replace from 'string-replace-to-array'; import replace from 'string-replace-to-array';
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
type Props = { type Props = {
highlight: ?string, highlight: ?string,
@ -28,7 +27,7 @@ function Highlight({ highlight, caseSensitive, text, ...rest }: Props) {
} }
const Mark = styled.mark` const Mark = styled.mark`
background: ${color.yellow}; background: ${props => props.theme.yellow};
`; `;
export default Highlight; export default Highlight;

View File

@ -2,7 +2,6 @@
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import { size, color } from 'shared/styles/constants';
const RealTextarea = styled.textarea` const RealTextarea = styled.textarea`
border: 0; border: 0;
@ -13,7 +12,7 @@ const RealTextarea = styled.textarea`
&:disabled, &:disabled,
&::placeholder { &::placeholder {
color: ${color.slate}; color: ${props => props.theme.slate};
} }
`; `;
@ -26,7 +25,7 @@ const RealInput = styled.input`
&:disabled, &:disabled,
&::placeholder { &::placeholder {
color: ${color.slate}; color: ${props => props.theme.slate};
} }
`; `;
@ -37,16 +36,16 @@ const Wrapper = styled.div`
export const Outline = styled(Flex)` export const Outline = styled(Flex)`
display: flex; display: flex;
flex: 1; flex: 1;
margin: 0 0 ${size.large}; margin: 0 0 16px;
color: inherit; color: inherit;
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
border-color: ${props => (props.hasError ? 'red' : color.slateLight)}; border-color: ${props => (props.hasError ? 'red' : props.theme.slateLight)};
border-radius: 4px; border-radius: 4px;
font-weight: normal; font-weight: normal;
&:focus { &:focus {
border-color: ${color.slate}; border-color: ${props => props.theme.slate};
} }
`; `;

View File

@ -1,6 +1,5 @@
// @flow // @flow
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
const Key = styled.kbd` const Key = styled.kbd`
display: inline-block; display: inline-block;
@ -8,13 +7,13 @@ const Key = styled.kbd`
font: 11px 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, font: 11px 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier,
monospace; monospace;
line-height: 10px; line-height: 10px;
color: ${color.text}; color: ${props => props.theme.text};
vertical-align: middle; vertical-align: middle;
background-color: ${color.smokeLight}; background-color: ${props => props.theme.smokeLight};
border: solid 1px ${color.slateLight}; border: solid 1px ${props => props.theme.slateLight};
border-bottom-color: ${color.slate}; border-bottom-color: ${props => props.theme.slate};
border-radius: 3px; border-radius: 3px;
box-shadow: inset 0 -1px 0 ${color.slate}; box-shadow: inset 0 -1px 0 ${props => props.theme.slate};
`; `;
export default Key; export default Key;

View File

@ -3,7 +3,6 @@ import * as React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import styled from 'styled-components'; import styled from 'styled-components';
import { size } from 'shared/styles/constants';
type Props = { type Props = {
label: React.Node | string, label: React.Node | string,
@ -18,7 +17,7 @@ const Labeled = ({ label, children, ...props }: Props) => (
); );
export const Label = styled(Flex)` export const Label = styled(Flex)`
margin-bottom: ${size.medium}; margin-bottom: 8px;
font-size: 13px; font-size: 13px;
font-weight: 500; font-weight: 500;
text-transform: uppercase; text-transform: uppercase;

View File

@ -9,7 +9,6 @@ import { observer, inject } from 'mobx-react';
import keydown from 'react-keydown'; import keydown from 'react-keydown';
import Analytics from 'shared/components/Analytics'; import Analytics from 'shared/components/Analytics';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import { layout } from 'shared/styles/constants';
import { documentEditUrl, homeUrl, searchUrl } from 'utils/routeHelpers'; import { documentEditUrl, homeUrl, searchUrl } from 'utils/routeHelpers';
import { LoadingIndicatorBar } from 'components/LoadingIndicator'; import { LoadingIndicatorBar } from 'components/LoadingIndicator';
@ -133,7 +132,7 @@ const Content = styled(Flex)`
} }
${breakpoint('tablet')` ${breakpoint('tablet')`
margin-left: ${props => (props.editMode ? 0 : layout.sidebarWidth)}; margin-left: ${props => (props.editMode ? 0 : props.theme.sidebarWidth)};
`}; `};
`; `;

View File

@ -1,7 +1,6 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { color, fontSize } from 'shared/styles/constants';
type Props = { type Props = {
image?: React.Node, image?: React.Node,
@ -27,7 +26,7 @@ const Wrapper = styled.li`
display: flex; display: flex;
padding: 12px 0; padding: 12px 0;
margin: 0; margin: 0;
border-bottom: 1px solid ${color.smokeDark}; border-bottom: 1px solid ${props => props.theme.smokeDark};
`; `;
const Image = styled.div` const Image = styled.div`
@ -36,7 +35,7 @@ const Image = styled.div`
`; `;
const Heading = styled.h2` const Heading = styled.h2`
font-size: ${fontSize.medium}; font-size: 16px;
margin: 0; margin: 0;
`; `;
@ -46,8 +45,8 @@ const Content = styled.div`
const Subtitle = styled.p` const Subtitle = styled.p`
margin: 0; margin: 0;
font-size: ${fontSize.small}; font-size: 14px;
color: ${color.slate}; color: ${props => props.theme.slate};
`; `;
const Actions = styled.div` const Actions = styled.div`

View File

@ -2,7 +2,6 @@
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { pulsate } from 'shared/styles/animations'; import { pulsate } from 'shared/styles/animations';
import { color } from 'shared/styles/constants';
import { randomInteger } from 'shared/random'; import { randomInteger } from 'shared/random';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
@ -26,7 +25,7 @@ const Redacted = styled(Flex)`
width: ${props => (props.header ? props.width / 2 : props.width)}%; width: ${props => (props.header ? props.width / 2 : props.width)}%;
height: ${props => (props.header ? 28 : 18)}px; height: ${props => (props.header ? 28 : 18)}px;
margin-bottom: ${props => (props.header ? 18 : 12)}px; margin-bottom: ${props => (props.header ? 18 : 12)}px;
background-color: ${color.smokeDark}; background-color: ${props => props.theme.smokeDark};
animation: ${pulsate} 1.3s infinite; animation: ${pulsate} 1.3s infinite;
&:last-child { &:last-child {

View File

@ -5,7 +5,6 @@ import styled, { injectGlobal } from 'styled-components';
import breakpoint from 'styled-components-breakpoint'; import breakpoint from 'styled-components-breakpoint';
import ReactModal from 'react-modal'; import ReactModal from 'react-modal';
import { CloseIcon } from 'outline-icons'; import { CloseIcon } from 'outline-icons';
import { color } from 'shared/styles/constants';
import { fadeAndScaleIn } from 'shared/styles/animations'; import { fadeAndScaleIn } from 'shared/styles/animations';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
@ -84,7 +83,7 @@ const Close = styled.a`
top: 16px; top: 16px;
right: 16px; right: 16px;
opacity: 0.5; opacity: 0.5;
color: ${color.text}; color: ${props => props.theme.text};
&:hover { &:hover {
opacity: 1; opacity: 1;

View File

@ -7,7 +7,6 @@ import breakpoint from 'styled-components-breakpoint';
import { observer, inject } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import { CloseIcon, MenuIcon } from 'outline-icons'; import { CloseIcon, MenuIcon } from 'outline-icons';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import { color, layout } from 'shared/styles/constants';
import AuthStore from 'stores/AuthStore'; import AuthStore from 'stores/AuthStore';
import DocumentsStore from 'stores/DocumentsStore'; import DocumentsStore from 'stores/DocumentsStore';
@ -59,9 +58,9 @@ const Container = styled(Flex)`
position: fixed; position: fixed;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: ${props => (props.editMode ? `-${layout.sidebarWidth}` : 0)}; left: ${props => (props.editMode ? `-${props.theme.sidebarWidth}` : 0)};
width: 100%; width: 100%;
background: ${color.smoke}; background: ${props => props.theme.smoke};
transition: left 200ms ease-in-out; transition: left 200ms ease-in-out;
margin-left: ${props => (props.mobileSidebarVisible ? 0 : '-100%')}; margin-left: ${props => (props.mobileSidebarVisible ? 0 : '-100%')};
z-index: 1; z-index: 1;
@ -72,7 +71,7 @@ const Container = styled(Flex)`
} }
${breakpoint('tablet')` ${breakpoint('tablet')`
width: ${layout.sidebarWidth}; width: ${props => props.theme.sidebarWidth};
margin: 0; margin: 0;
`}; `};
`; `;

View File

@ -1,13 +1,12 @@
// @flow // @flow
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import styled from 'styled-components'; import styled from 'styled-components';
import { color, fontWeight } from 'shared/styles/constants';
const Header = styled(Flex)` const Header = styled(Flex)`
font-size: 11px; font-size: 11px;
font-weight: ${fontWeight.semiBold}; font-weight: 600;
text-transform: uppercase; text-transform: uppercase;
color: ${color.slateDark}; color: ${props => props.theme.slateDark};
letter-spacing: 0.04em; letter-spacing: 0.04em;
margin-bottom: 4px; margin-bottom: 4px;
`; `;

View File

@ -1,7 +1,6 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled, { withTheme } from 'styled-components';
import { color } from 'shared/styles/constants';
import { ExpandedIcon } from 'outline-icons'; import { ExpandedIcon } from 'outline-icons';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import TeamLogo from './TeamLogo'; import TeamLogo from './TeamLogo';
@ -11,6 +10,7 @@ type Props = {
subheading: string, subheading: string,
showDisclosure?: boolean, showDisclosure?: boolean,
logoUrl: string, logoUrl: string,
theme: Object,
}; };
function HeaderBlock({ function HeaderBlock({
@ -18,6 +18,7 @@ function HeaderBlock({
teamName, teamName,
subheading, subheading,
logoUrl, logoUrl,
theme,
...rest ...rest
}: Props) { }: Props) {
return ( return (
@ -26,7 +27,7 @@ function HeaderBlock({
<Flex align="flex-start" column> <Flex align="flex-start" column>
<TeamName showDisclosure> <TeamName showDisclosure>
{teamName}{' '} {teamName}{' '}
{showDisclosure && <StyledExpandedIcon color={color.text} />} {showDisclosure && <StyledExpandedIcon color={theme.text} />}
</TeamName> </TeamName>
<Subheading>{subheading}</Subheading> <Subheading>{subheading}</Subheading>
</Flex> </Flex>
@ -45,7 +46,7 @@ const Subheading = styled.div`
font-size: 11px; font-size: 11px;
text-transform: uppercase; text-transform: uppercase;
font-weight: 500; font-weight: 500;
color: ${color.slateDark}; color: ${props => props.theme.slateDark};
`; `;
const TeamName = styled.div` const TeamName = styled.div`
@ -53,7 +54,7 @@ const TeamName = styled.div`
padding-left: 10px; padding-left: 10px;
padding-right: 24px; padding-right: 24px;
font-weight: 600; font-weight: 600;
color: ${color.text}; color: ${props => props.theme.text};
text-decoration: none; text-decoration: none;
font-size: 16px; font-size: 16px;
`; `;
@ -72,4 +73,4 @@ const Header = styled(Flex)`
} }
`; `;
export default HeaderBlock; export default withTheme(HeaderBlock);

View File

@ -4,15 +4,9 @@ import { observable, action } from 'mobx';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import { withRouter, NavLink } from 'react-router-dom'; import { withRouter, NavLink } from 'react-router-dom';
import { CollapsedIcon } from 'outline-icons'; import { CollapsedIcon } from 'outline-icons';
import { color, fontWeight } from 'shared/styles/constants'; import styled, { withTheme } from 'styled-components';
import styled from 'styled-components';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
const activeStyle = {
color: color.black,
fontWeight: fontWeight.medium,
};
const StyledGoTo = styled(CollapsedIcon)` const StyledGoTo = styled(CollapsedIcon)`
margin-bottom: -4px; margin-bottom: -4px;
margin-left: 1px; margin-left: 1px;
@ -34,12 +28,12 @@ const StyledNavLink = styled(NavLink)`
text-overflow: ellipsis; text-overflow: ellipsis;
padding: 4px 0; padding: 4px 0;
margin-left: ${({ icon }) => (icon ? '-20px;' : '0')}; margin-left: ${({ icon }) => (icon ? '-20px;' : '0')};
color: ${color.slateDark}; color: ${props => props.theme.slateDark};
font-size: 15px; font-size: 15px;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: ${color.text}; color: ${props => props.theme.text};
} }
`; `;
@ -57,11 +51,22 @@ type Props = {
hideExpandToggle?: boolean, hideExpandToggle?: boolean,
iconColor?: string, iconColor?: string,
active?: boolean, active?: boolean,
theme: Object,
}; };
@observer @observer
class SidebarLink extends React.Component<Props> { class SidebarLink extends React.Component<Props> {
@observable expanded: boolean = false; @observable expanded: boolean = false;
activeStyle: Object;
constructor(props) {
super(props);
this.activeStyle = {
color: props.theme.black,
fontWeight: 500,
};
}
componentDidMount() { componentDidMount() {
if (this.props.expand) this.handleExpand(); if (this.props.expand) this.handleExpand();
@ -104,8 +109,8 @@ class SidebarLink extends React.Component<Props> {
<Wrapper menuOpen={menuOpen} column> <Wrapper menuOpen={menuOpen} column>
<Component <Component
icon={showExpandIcon} icon={showExpandIcon}
activeStyle={activeStyle} activeStyle={this.activeStyle}
style={active ? activeStyle : undefined} style={active ? this.activeStyle : undefined}
onClick={onClick} onClick={onClick}
to={to} to={to}
exact exact
@ -128,7 +133,7 @@ const Action = styled.span`
position: absolute; position: absolute;
right: 0; right: 0;
top: 2px; top: 2px;
color: ${color.slate}; color: ${props => props.theme.slate};
svg { svg {
opacity: 0.75; opacity: 0.75;
} }
@ -158,4 +163,4 @@ const Content = styled.div`
width: 100%; width: 100%;
`; `;
export default withRouter(SidebarLink); export default withRouter(withTheme(SidebarLink));

View File

@ -1,13 +1,12 @@
// @flow // @flow
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
const TeamLogo = styled.img` const TeamLogo = styled.img`
width: 38px; width: 38px;
height: 38px; height: 38px;
border-radius: 4px; border-radius: 4px;
background: ${color.white}; background: ${props => props.theme.white};
border: 1px solid ${color.slateLight}; border: 1px solid ${props => props.theme.slateLight};
`; `;
export default TeamLogo; export default TeamLogo;

View File

@ -1,14 +1,13 @@
// @flow // @flow
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
const Subheading = styled.h3` const Subheading = styled.h3`
font-size: 11px; font-size: 11px;
font-weight: 500; font-weight: 500;
text-transform: uppercase; text-transform: uppercase;
color: ${color.slate}; color: ${props => props.theme.slate};
letter-spacing: 0.04em; letter-spacing: 0.04em;
border-bottom: 1px solid ${color.slateLight}; border-bottom: 1px solid ${props => props.theme.slateLight};
padding-bottom: 8px; padding-bottom: 8px;
margin-top: 30px; margin-top: 30px;
margin-bottom: 10px; margin-bottom: 10px;

View File

@ -2,7 +2,6 @@
import * as React from 'react'; import * as React from 'react';
import { observer } from 'mobx-react'; import { observer } from 'mobx-react';
import styled from 'styled-components'; import styled from 'styled-components';
import { layout } from 'shared/styles/constants';
import Toast from './components/Toast'; import Toast from './components/Toast';
import UiStore from '../../stores/UiStore'; import UiStore from '../../stores/UiStore';
@ -34,8 +33,8 @@ class Toasts extends React.Component<Props> {
const List = styled.ol` const List = styled.ol`
position: fixed; position: fixed;
left: ${layout.hpadding}; left: ${props => props.theme.hpadding};
bottom: ${layout.vpadding}; bottom: ${props => props.theme.vpadding};
list-style: none; list-style: none;
margin: 0; margin: 0;
padding: 0; padding: 0;

View File

@ -2,7 +2,6 @@
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { darken } from 'polished'; import { darken } from 'polished';
import { color } from 'shared/styles/constants';
import { fadeAndScaleIn } from 'shared/styles/animations'; import { fadeAndScaleIn } from 'shared/styles/animations';
import type { Toast as TToast } from '../../../types'; import type { Toast as TToast } from '../../../types';
@ -51,14 +50,14 @@ const Container = styled.li`
animation: ${fadeAndScaleIn} 100ms ease; animation: ${fadeAndScaleIn} 100ms ease;
margin: 8px 0; margin: 8px 0;
padding: 8px; padding: 8px;
color: ${color.white}; color: ${props => props.theme.white};
background: ${props => color[props.type]}; background: ${props => props.theme[props.type]};
font-size: 15px; font-size: 15px;
border-radius: 5px; border-radius: 5px;
cursor: default; cursor: default;
&:hover { &:hover {
background: ${props => darken(0.05, color[props.type])}; background: ${props => darken(0.05, props.theme[props.type])};
} }
`; `;

View File

@ -2,6 +2,7 @@
import * as React from 'react'; import * as React from 'react';
import { render } from 'react-dom'; import { render } from 'react-dom';
import { Provider } from 'mobx-react'; import { Provider } from 'mobx-react';
import { ThemeProvider } from 'styled-components';
import { import {
BrowserRouter as Router, BrowserRouter as Router,
Switch, Switch,
@ -10,6 +11,7 @@ import {
} from 'react-router-dom'; } from 'react-router-dom';
import stores from 'stores'; import stores from 'stores';
import theme from 'shared/styles/theme';
import globalStyles from 'shared/styles/globals'; import globalStyles from 'shared/styles/globals';
import 'shared/styles/prism.css'; import 'shared/styles/prism.css';
@ -55,6 +57,7 @@ if (element) {
render( render(
<React.Fragment> <React.Fragment>
<ErrorBoundary> <ErrorBoundary>
<ThemeProvider theme={theme}>
<Provider {...stores}> <Provider {...stores}>
<Router> <Router>
<ScrollToTop> <ScrollToTop>
@ -73,9 +76,21 @@ if (element) {
path="/settings/details" path="/settings/details"
component={Details} component={Details}
/> />
<Route exact path="/settings/people" component={People} /> <Route
<Route exact path="/settings/shares" component={Shares} /> exact
<Route exact path="/settings/tokens" component={Tokens} /> path="/settings/people"
component={People}
/>
<Route
exact
path="/settings/shares"
component={Shares}
/>
<Route
exact
path="/settings/tokens"
component={Tokens}
/>
<Route <Route
exact exact
path="/settings/integrations/slack" path="/settings/integrations/slack"
@ -122,6 +137,7 @@ if (element) {
</ScrollToTop> </ScrollToTop>
</Router> </Router>
</Provider> </Provider>
</ThemeProvider>
</ErrorBoundary> </ErrorBoundary>
{DevTools && <DevTools position={{ bottom: 0, right: 0 }} />} {DevTools && <DevTools position={{ bottom: 0, right: 0 }} />}
</React.Fragment>, </React.Fragment>,

View File

@ -330,7 +330,7 @@ const Container = styled(Flex)`
`; `;
const LoadingState = styled(LoadingPlaceholder)` const LoadingState = styled(LoadingPlaceholder)`
margin: 90px 0; margin: 40px 0;
`; `;
export default withRouter(inject('ui', 'auth', 'documents')(DocumentScene)); export default withRouter(inject('ui', 'auth', 'documents')(DocumentScene));

View File

@ -2,8 +2,6 @@
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { NewDocumentIcon } from 'outline-icons'; import { NewDocumentIcon } from 'outline-icons';
import { color } from 'shared/styles/constants';
import Document from 'models/Document'; import Document from 'models/Document';
import { documentEditUrl, documentNewUrl } from 'utils/routeHelpers'; import { documentEditUrl, documentNewUrl } from 'utils/routeHelpers';
@ -123,7 +121,7 @@ const Link = styled.a`
align-items: center; align-items: center;
font-weight: ${props => (props.highlight ? 500 : 'inherit')}; font-weight: ${props => (props.highlight ? 500 : 'inherit')};
color: ${props => color: ${props =>
props.highlight ? `${color.primary} !important` : 'inherit'}; props.highlight ? `${props.theme.primary} !important` : 'inherit'};
opacity: ${props => (props.disabled ? 0.5 : 1)}; opacity: ${props => (props.disabled ? 0.5 : 1)};
pointer-events: ${props => (props.disabled ? 'none' : 'auto')}; pointer-events: ${props => (props.disabled ? 'none' : 'auto')};
cursor: ${props => (props.disabled ? 'default' : 'pointer')}; cursor: ${props => (props.disabled ? 'default' : 'pointer')};

View File

@ -8,7 +8,6 @@ import { Search } from 'js-search';
import ArrowKeyNavigation from 'boundless-arrow-key-navigation'; import ArrowKeyNavigation from 'boundless-arrow-key-navigation';
import _ from 'lodash'; import _ from 'lodash';
import styled from 'styled-components'; import styled from 'styled-components';
import { size } from 'shared/styles/constants';
import Modal from 'components/Modal'; import Modal from 'components/Modal';
import Input from 'components/Input'; import Input from 'components/Input';
@ -181,7 +180,7 @@ class DocumentMove extends React.Component<Props> {
} }
const Section = styled(Flex)` const Section = styled(Flex)`
margin-bottom: ${size.huge}; margin-bottom: 24px;
`; `;
const StyledArrowKeyNavigation = styled(ArrowKeyNavigation)` const StyledArrowKeyNavigation = styled(ArrowKeyNavigation)`

View File

@ -4,8 +4,6 @@ import { observer } from 'mobx-react';
import invariant from 'invariant'; import invariant from 'invariant';
import styled from 'styled-components'; import styled from 'styled-components';
import { GoToIcon } from 'outline-icons'; import { GoToIcon } from 'outline-icons';
import { color } from 'shared/styles/constants';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import Document from 'models/Document'; import Document from 'models/Document';
@ -14,7 +12,7 @@ const ResultWrapper = styled.div`
display: flex; display: flex;
margin-bottom: 10px; margin-bottom: 10px;
color: ${color.text}; color: ${props => props.theme.text};
cursor: default; cursor: default;
`; `;
@ -30,13 +28,13 @@ const ResultWrapperLink = ResultWrapper.withComponent('a').extend`
&:focus { &:focus {
margin-left: 0px; margin-left: 0px;
border-radius: 2px; border-radius: 2px;
background: ${color.black}; background: ${props => props.theme.black};
color: ${color.smokeLight}; color: ${props => props.theme.smokeLight};
outline: none; outline: none;
cursor: pointer; cursor: pointer;
${StyledGoToIcon} { ${StyledGoToIcon} {
fill: ${color.white}; fill: ${props => props.theme.white};
} }
} }
`; `;

View File

@ -2,7 +2,6 @@
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { pulsate } from 'shared/styles/animations'; import { pulsate } from 'shared/styles/animations';
import { color } from 'shared/styles/constants';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import Fade from 'components/Fade'; import Fade from 'components/Fade';
@ -29,7 +28,7 @@ const LoadingPlaceholder = (props: Object) => {
const Mask = styled(Flex)` const Mask = styled(Flex)`
height: ${props => (props.header ? 28 : 18)}px; height: ${props => (props.header ? 28 : 18)}px;
margin-bottom: ${props => (props.header ? 32 : 14)}px; margin-bottom: ${props => (props.header ? 32 : 14)}px;
background-color: ${color.smoke}; background-color: ${props => props.theme.smoke};
animation: ${pulsate} 1.3s infinite; animation: ${pulsate} 1.3s infinite;
`; `;

View File

@ -1,13 +1,12 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled, { withTheme } from 'styled-components';
import { SearchIcon } from 'outline-icons'; import { SearchIcon } from 'outline-icons';
import Flex from 'shared/components/Flex'; import Flex from 'shared/components/Flex';
import { color } from 'shared/styles/constants';
type Props = { type Props = {
onChange: string => *, onChange: string => *,
theme: Object,
}; };
class SearchField extends React.Component<Props> { class SearchField extends React.Component<Props> {
@ -31,7 +30,7 @@ class SearchField extends React.Component<Props> {
<StyledIcon <StyledIcon
type="Search" type="Search"
size={46} size={46}
color={color.slateLight} color={this.props.theme.slateLight}
onClick={this.focusInput} onClick={this.focusInput}
/> />
<StyledInput <StyledInput
@ -56,16 +55,16 @@ const StyledInput = styled.input`
border: 0; border: 0;
::-webkit-input-placeholder { ::-webkit-input-placeholder {
color: ${color.slateLight}; color: ${props => props.theme.slateLight};
} }
:-moz-placeholder { :-moz-placeholder {
color: ${color.slateLight}; color: ${props => props.theme.slateLight};
} }
::-moz-placeholder { ::-moz-placeholder {
color: ${color.slateLight}; color: ${props => props.theme.slateLight};
} }
:-ms-input-placeholder { :-ms-input-placeholder {
color: ${color.slateLight}; color: ${props => props.theme.slateLight};
} }
`; `;
@ -74,4 +73,4 @@ const StyledIcon = styled(SearchIcon)`
top: 4px; top: 4px;
`; `;
export default SearchField; export default withTheme(SearchField);

View File

@ -3,7 +3,6 @@ import * as React from 'react';
import { observable } from 'mobx'; import { observable } from 'mobx';
import { observer, inject } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import styled from 'styled-components'; import styled from 'styled-components';
import { color, size } from 'shared/styles/constants';
import AuthStore from 'stores/AuthStore'; import AuthStore from 'stores/AuthStore';
import UiStore from 'stores/UiStore'; import UiStore from 'stores/UiStore';
@ -120,7 +119,7 @@ class Details extends React.Component<Props> {
} }
const ProfilePicture = styled(Flex)` const ProfilePicture = styled(Flex)`
margin-bottom: ${size.huge}; margin-bottom: 24px;
`; `;
const avatarStyles = ` const avatarStyles = `
@ -133,7 +132,7 @@ const AvatarContainer = styled(Flex)`
${avatarStyles}; ${avatarStyles};
position: relative; position: relative;
box-shadow: 0 0 0 1px #dae1e9; box-shadow: 0 0 0 1px #dae1e9;
background: ${color.white}; background: ${props => props.theme.white};
div div { div div {
${avatarStyles}; ${avatarStyles};
@ -150,7 +149,7 @@ const AvatarContainer = styled(Flex)`
&:hover div { &:hover div {
opacity: 1; opacity: 1;
background: rgba(0, 0, 0, 0.75); background: rgba(0, 0, 0, 0.75);
color: ${color.white}; color: ${props => props.theme.white};
} }
`; `;

View File

@ -3,7 +3,6 @@ import * as React from 'react';
import { observable } from 'mobx'; import { observable } from 'mobx';
import { observer, inject } from 'mobx-react'; import { observer, inject } from 'mobx-react';
import styled from 'styled-components'; import styled from 'styled-components';
import { color, size } from 'shared/styles/constants';
import AuthStore from 'stores/AuthStore'; import AuthStore from 'stores/AuthStore';
import UiStore from 'stores/UiStore'; import UiStore from 'stores/UiStore';
@ -104,7 +103,7 @@ class Profile extends React.Component<Props> {
} }
const ProfilePicture = styled(Flex)` const ProfilePicture = styled(Flex)`
margin-bottom: ${size.huge}; margin-bottom: 24px;
`; `;
const avatarStyles = ` const avatarStyles = `
@ -132,7 +131,7 @@ const AvatarContainer = styled(Flex)`
&:hover div { &:hover div {
opacity: 1; opacity: 1;
background: rgba(0, 0, 0, 0.75); background: rgba(0, 0, 0, 0.75);
color: ${color.white}; color: ${props => props.theme.white};
} }
`; `;

View File

@ -1,7 +1,6 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from 'shared/styles/constants';
import UserMenu from 'menus/UserMenu'; import UserMenu from 'menus/UserMenu';
import Avatar from 'components/Avatar'; import Avatar from 'components/Avatar';
@ -34,8 +33,9 @@ const UserListItem = ({ user, isCurrentUser }: Props) => {
const Badge = styled.span` const Badge = styled.span`
margin-left: 10px; margin-left: 10px;
padding: 2px 6px 3px; padding: 2px 6px 3px;
background-color: ${({ admin }) => (admin ? color.primary : color.smokeDark)}; background-color: ${({ admin, theme }) =>
color: ${({ admin }) => (admin ? color.white : color.text)}; admin ? theme.primary : theme.smokeDark};
color: ${({ admin, theme }) => (admin ? theme.white : theme.text)};
border-radius: 2px; border-radius: 2px;
font-size: 11px; font-size: 11px;
text-transform: uppercase; text-transform: uppercase;

View File

@ -1,7 +1,7 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import { Table, TBody, TR, TD } from 'oy-vey'; import { Table, TBody, TR, TD } from 'oy-vey';
import { fonts } from '../../../shared/styles/constants'; import theme from '../../../shared/styles/theme';
type Props = { type Props = {
children: React.Node, children: React.Node,
@ -19,7 +19,7 @@ export default (props: Props) => (
export const baseStyles = ` export const baseStyles = `
#__bodyTable__ { #__bodyTable__ {
font-family: ${fonts.regular}; font-family: ${theme.fontFamily};
font-size: 16px; font-size: 16px;
line-height: 1.5; line-height: 1.5;
} }

View File

@ -1,26 +1,26 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
import { Table, TBody, TR, TD } from 'oy-vey'; import { Table, TBody, TR, TD } from 'oy-vey';
import { color } from '../../../shared/styles/constants';
import { twitterUrl, spectrumUrl } from '../../../shared/utils/routeHelpers'; import { twitterUrl, spectrumUrl } from '../../../shared/utils/routeHelpers';
import theme from '../../../shared/styles/theme';
export default () => { export default () => {
const style = { const style = {
padding: '20px 0', padding: '20px 0',
borderTop: `1px solid ${color.smokeDark}`, borderTop: `1px solid ${theme.smokeDark}`,
color: color.slate, color: theme.slate,
fontSize: '14px', fontSize: '14px',
}; };
const linkStyle = { const linkStyle = {
color: color.slate, color: theme.slate,
fontWeight: 500, fontWeight: 500,
textDecoration: 'none', textDecoration: 'none',
marginRight: '10px', marginRight: '10px',
}; };
const externalLinkStyle = { const externalLinkStyle = {
color: color.slate, color: theme.slate,
textDecoration: 'none', textDecoration: 'none',
margin: '0 10px', margin: '0 10px',
}; };

View File

@ -6,7 +6,6 @@ import Grid from 'styled-components-grid';
import ReactMarkdown from 'react-markdown'; import ReactMarkdown from 'react-markdown';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import Header from './components/Header'; import Header from './components/Header';
import { color } from '../../shared/styles/constants';
type Release = { type Release = {
id: string, id: string,
@ -46,7 +45,7 @@ function Changelog({ releases }: { releases: Release[] }) {
const Heading = styled.h1` const Heading = styled.h1`
a { a {
color: ${color.text}; color: ${props => props.theme.text};
} }
a:hover { a:hover {
text-decoration: underline; text-decoration: underline;
@ -54,7 +53,7 @@ const Heading = styled.h1`
`; `;
const Time = styled.time` const Time = styled.time`
color: ${color.slateDark}; color: ${props => props.theme.slateDark};
margin-top: -16px; margin-top: -16px;
display: block; display: block;
`; `;
@ -67,7 +66,7 @@ const Container = styled.div`
`; `;
const Article = styled.div` const Article = styled.div`
border-bottom: 1px solid ${color.slateLight}; border-bottom: 1px solid ${props => props.theme.slateLight};
padding-bottom: 2em; padding-bottom: 2em;
&:last-child { &:last-child {

View File

@ -8,7 +8,6 @@ import Notice from '../../shared/components/Notice';
import Hero from './components/Hero'; import Hero from './components/Hero';
import SigninButtons from './components/SigninButtons'; import SigninButtons from './components/SigninButtons';
import { developers, githubUrl } from '../../shared/utils/routeHelpers'; import { developers, githubUrl } from '../../shared/utils/routeHelpers';
import { color } from '../../shared/styles/constants';
type Props = { type Props = {
notice?: 'google-hd' | 'auth-error', notice?: 'google-hd' | 'auth-error',
@ -133,7 +132,7 @@ const Screenshot = styled.img`
`; `;
const Highlights = styled(Grid)` const Highlights = styled(Grid)`
background: ${color.yellow}; background: ${props => props.theme.yellow};
margin: 0 1em; margin: 0 1em;
padding: 0 1em; padding: 0 1em;
`; `;
@ -151,7 +150,7 @@ const Feature = styled(Grid.Unit)`
} }
a { a {
color: ${color.black}; color: ${props => props.theme.black};
text-decoration: underline; text-decoration: underline;
text-transform: uppercase; text-transform: uppercase;
font-weight: 500; font-weight: 500;

View File

@ -1,12 +1,11 @@
// @flow // @flow
import styled from 'styled-components'; import styled from 'styled-components';
import { color } from '../../../shared/styles/constants';
const Header = styled.div` const Header = styled.div`
width: 100%; width: 100%;
padding: 0 2em 2em; padding: 0 2em 2em;
text-align: center; text-align: center;
background: ${color.slateLight}; background: ${props => props.theme.slateLight};
margin-bottom: 2em; margin-bottom: 2em;
p { p {

View File

@ -4,7 +4,6 @@ import { Helmet } from 'react-helmet';
import { TopNavigation, BottomNavigation } from './Navigation'; import { TopNavigation, BottomNavigation } from './Navigation';
import Analytics from '../../../shared/components/Analytics'; import Analytics from '../../../shared/components/Analytics';
import globalStyles from '../../../shared/styles/globals'; import globalStyles from '../../../shared/styles/globals';
import { color } from '../../../shared/styles/constants';
import prefetchTags from '../../utils/prefetchTags'; import prefetchTags from '../../utils/prefetchTags';
export const title = 'Outline'; export const title = 'Outline';
@ -43,7 +42,6 @@ export default function Layout({ children }: Props) {
<meta name="twitter:image" content={screenshotUrl} /> <meta name="twitter:image" content={screenshotUrl} />
<meta name="twitter:url" value={process.env.URL} /> <meta name="twitter:url" value={process.env.URL} />
<meta name="theme-color" content={color.primary} />
<link <link
rel="shortcut icon" rel="shortcut icon"
type="image/png" type="image/png"

View File

@ -13,7 +13,6 @@ import {
spectrumUrl, spectrumUrl,
blogUrl, blogUrl,
} from '../../../shared/utils/routeHelpers'; } from '../../../shared/utils/routeHelpers';
import { color } from '../../../shared/styles/constants';
function TopNavigation() { function TopNavigation() {
return ( return (
@ -65,16 +64,16 @@ function BottomNavigation() {
); );
} }
const MenuLinkStyle = ` const MenuLinkStyle = props => `
font-size: 15px; font-size: 15px;
font-weight: 500; font-weight: 500;
a { a {
color: ${color.slate}; color: ${props.theme.slate};
} }
a:hover { a:hover {
color: ${color.slateDark}; color: ${props.theme.slateDark};
text-decoration: underline; text-decoration: underline;
} }
`; `;
@ -141,7 +140,7 @@ const Brand = styled.a`
font-weight: 600; font-weight: 600;
font-size: 20px; font-size: 20px;
text-decoration: none; text-decoration: none;
color: ${color.black}; color: ${props => props.theme.black};
`; `;
export { TopNavigation, BottomNavigation }; export { TopNavigation, BottomNavigation };

View File

@ -5,7 +5,6 @@ import { signin } from '../../../shared/utils/routeHelpers';
import Flex from '../../../shared/components/Flex'; import Flex from '../../../shared/components/Flex';
import GoogleLogo from '../../../shared/components/GoogleLogo'; import GoogleLogo from '../../../shared/components/GoogleLogo';
import SlackLogo from '../../../shared/components/SlackLogo'; import SlackLogo from '../../../shared/components/SlackLogo';
import { color } from '../../../shared/styles/constants';
type Props = { type Props = {
lastSignedIn: string, lastSignedIn: string,
@ -56,8 +55,8 @@ const Button = styled.a`
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
padding: 10px 20px; padding: 10px 20px;
color: ${color.white}; color: ${props => props.theme.white};
background: ${color.black}; background: ${props => props.theme.black};
border-radius: 4px; border-radius: 4px;
font-weight: 600; font-weight: 600;
height: 56px; height: 56px;
@ -65,7 +64,7 @@ const Button = styled.a`
const LastLogin = styled.p` const LastLogin = styled.p`
font-size: 12px; font-size: 12px;
color: ${color.slate}; color: ${props => props.theme.slate};
padding-top: 4px; padding-top: 4px;
`; `;

View File

@ -2,15 +2,22 @@
import * as React from 'react'; import * as React from 'react';
import ReactDOMServer from 'react-dom/server'; import ReactDOMServer from 'react-dom/server';
import { Helmet } from 'react-helmet'; import { Helmet } from 'react-helmet';
import { ServerStyleSheet, StyleSheetManager } from 'styled-components'; import {
ServerStyleSheet,
StyleSheetManager,
ThemeProvider,
} from 'styled-components';
import Layout from '../pages/components/Layout'; import Layout from '../pages/components/Layout';
import theme from '../../shared/styles/theme';
const sheet = new ServerStyleSheet(); const sheet = new ServerStyleSheet();
export default function renderpage(ctx: Object, children: React.Node) { export default function renderpage(ctx: Object, children: React.Node) {
const html = ReactDOMServer.renderToString( const html = ReactDOMServer.renderToString(
<StyleSheetManager sheet={sheet.instance}> <StyleSheetManager sheet={sheet.instance}>
<ThemeProvider theme={theme}>
<Layout>{children}</Layout> <Layout>{children}</Layout>
</ThemeProvider>
</StyleSheetManager> </StyleSheetManager>
); );

View File

@ -1,5 +1,5 @@
// @flow // @flow
import { color } from './constants'; import theme from './theme';
export default ` export default `
* { * {
@ -27,7 +27,7 @@ export default `
body { body {
font-size: 16px; font-size: 16px;
line-height: 1.5; line-height: 1.5;
color: ${color.text}; color: ${theme.text};
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
@ -35,7 +35,7 @@ export default `
} }
a { a {
color: ${color.blue}; color: ${theme.blue};
text-decoration: none; text-decoration: none;
cursor: pointer; cursor: pointer;
} }
@ -50,7 +50,7 @@ export default `
line-height: 1.25; line-height: 1.25;
margin-top: 1em; margin-top: 1em;
margin-bottom: 0.5em; margin-bottom: 0.5em;
color: ${color.text}; color: ${theme.text};
} }
h1 { font-size: 2em; } h1 { font-size: 2em; }
h2 { font-size: 1.5em; } h2 { font-size: 1.5em; }

View File

@ -1,70 +0,0 @@
// @flow
export const layout = {
padding: '1.5vw 1.875vw',
vpadding: '1.5vw',
hpadding: '1.875vw',
sidebarWidth: '280px',
sidebarMinWidth: '250px',
sidebarMaxWidth: '350px',
};
export const size = {
tiny: '2px',
small: '4px',
medium: '8px',
large: '16px',
huge: '24px',
enormous: '32px',
};
export const fontSize = {
small: '14px',
medium: '16px',
large: '18px',
huge: '24px',
};
export const fontWeight = {
ultraLight: 100,
thin: 200,
light: 300,
regular: 400,
medium: 500,
semiBold: 600,
bold: 700,
heavy: 800,
};
export const fonts = {
regular: `-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;`,
monospace: `Menlo, Consolas, 'Liberation Mono', monospace;`,
};
export const color = {
text: '#171B35',
/* Brand */
primary: '#1AB6FF',
danger: '#D0021B',
warning: '#f08a24',
success: '#1AB6FF',
info: '#a0d3e8',
offline: '#000000',
/* Dark Grays */
slate: '#9BA6B2',
slateLight: '#DAE1E9',
slateDark: '#4E5C6E',
/* Light Grays */
smoke: '#F4F7FA',
smokeLight: '#F9FBFC',
smokeDark: '#E8EBED',
/* Misc */
white: '#FFFFFF',
black: '#000000',
blue: '#16B3FF',
yellow: '#FFD95C',
};

34
shared/styles/theme.js Normal file
View File

@ -0,0 +1,34 @@
// @flow
const theme = {
fontFamily:
"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen, Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif",
monospaceFontFamily: `Menlo, Consolas, 'Liberation Mono', monospace;`,
fontWeight: 400,
text: '#171B35',
link: '#1AB6FF',
primary: '#1AB6FF',
placeholder: '#b1becc',
slate: '#9BA6B2',
slateLight: '#DAE1E9',
slateDark: '#4E5C6E',
smoke: '#F4F7FA',
smokeLight: '#F9FBFC',
smokeDark: '#E8EBED',
white: '#FFFFFF',
blue: '#1AB6FF',
black: '#000000',
blackLight: '#2f3336',
padding: '1.5vw 1.875vw',
vpadding: '1.5vw',
hpadding: '1.875vw',
sidebarWidth: '280px',
sidebarMinWidth: '250px',
sidebarMaxWidth: '350px',
};
export default theme;