Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Improvements for theming
Browse files Browse the repository at this point in the history
  • Loading branch information
tommoor committed Jul 28, 2018
1 parent 87ffc09 commit 3c1d577
Show file tree
Hide file tree
Showing 15 changed files with 52 additions and 45 deletions.
13 changes: 8 additions & 5 deletions src/components/BlockInsert.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ class BlockInsert extends React.Component<Props, State> {
return (
<Portal>
<Trigger active={this.state.active} style={style}>
<PlusIcon onClick={this.handleClick} color={theme.slate} />
<PlusIcon
onClick={this.handleClick}
color={theme.blockToolbarTrigger}
/>
</Trigger>
</Portal>
);
Expand All @@ -139,21 +142,21 @@ const Trigger = styled.div`
position: absolute;
z-index: 1;
opacity: 0;
background-color: ${props => props.theme.white};
background-color: ${props => props.theme.background};
transition: opacity 150ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
transform 150ms cubic-bezier(0.175, 0.885, 0.32, 1.275);
line-height: 0;
margin-left: -10px;
box-shadow: inset 0 0 0 2px ${props => props.theme.slate};
box-shadow: inset 0 0 0 2px ${props => props.theme.blockToolbarTrigger};
border-radius: 100%;
transform: scale(0.9);
cursor: pointer;
&:hover {
background-color: ${props => props.theme.slate};
background-color: ${props => props.theme.blockToolbarTrigger};
svg {
fill: ${props => props.theme.white};
fill: ${props => props.theme.blockToolbarTriggerIcon};
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Code.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export default function Code({

const Container = styled.div`
position: relative;
background: ${props => props.theme.smokeLight};
background: ${props => props.theme.codeBackground};
border-radius: 4px;
border: 1px solid ${props => props.theme.smokeDark};
border: 1px solid ${props => props.theme.codeBorder};
code {
display: block;
Expand Down
9 changes: 5 additions & 4 deletions src/components/Contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ const Wrapper = styled.div`
`;

const Anchor = styled.a`
color: ${props => (props.active ? props.theme.slateDark : props.theme.slate)};
color: ${props =>
props.active ? props.theme.text : props.theme.textSecondary};
font-weight: ${props => (props.active ? 500 : 400)};
opacity: 0;
transition: all 100ms ease-in-out;
Expand All @@ -129,13 +130,13 @@ const ListItem = styled.li`
position: relative;
margin-left: ${props => (props.type.match(/heading[12]/) ? "8px" : "16px")};
text-align: right;
color: ${props => props.theme.slate};
color: ${props => props.theme.textSecondary};
padding-right: 16px;
white-space: nowrap;
&:after {
color: ${props =>
props.active ? props.theme.slateDark : props.theme.slate};
props.active ? props.theme.text : props.theme.textSecondary};
content: "${props => (props.type.match(/heading[12]/) ? "—" : "–")}";
position: absolute;
right: 0;
Expand All @@ -158,7 +159,7 @@ const Sections = styled.ol`
${Anchor} {
opacity: 1;
margin-right: 0;
background: ${props => props.theme.white};
background: ${props => props.theme.background};
pointer-events: all;
}
}
Expand Down
11 changes: 4 additions & 7 deletions src/components/CopyButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@ const StyledCopyToClipboard = styled(CopyToClipboard)`
transition: opacity 50ms ease-in-out;
z-index: 1;
font-size: 12px;
background: ${props => props.theme.smoke};
border-radius: 0 2px 0 2px;
padding: 1px 6px;
color: ${props => props.theme.textLight};
background: ${props => props.theme.primary};
border-radius: 0 4px 0 4px;
padding: 1px 8px;
cursor: pointer;
&:hover {
background: ${props => props.theme.smokeDark};
}
`;

export default CopyButton;
4 changes: 2 additions & 2 deletions src/components/Heading.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ export const StyledHeading = styled(Heading)`
&:hover {
${Anchor} {
color: ${props => props.theme.slate};
color: ${props => props.theme.textSecondary};
visibility: visible;
text-decoration: none;
&:hover {
color: ${props => props.theme.slateDark};
color: ${props => props.theme.text};
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/HorizontalRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const StyledHr = styled.hr`
margin: 0;
border: 0;
border-bottom: 1px solid
${props => (props.active ? props.theme.slate : props.theme.slateLight)};
${props =>
props.active ? props.theme.selected : props.theme.horizontalRule};
`;

export default HorizontalRule;
6 changes: 3 additions & 3 deletions src/components/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const Error = styled.div`
const StyledImg = styled.img`
max-width: 100%;
box-shadow: ${props =>
props.active ? `0 0 0 2px ${props.theme.slate}` : "none"};
props.active ? `0 0 0 2px ${props.theme.selected}` : "none"};
border-radius: ${props => (props.active ? `2px` : "0")};
opacity: ${props => (props.loading ? 0.5 : 1)};
`;
Expand All @@ -131,7 +131,7 @@ const Caption = styled.input`
display: block;
font-size: 13px;
font-style: italic;
color: ${props => props.theme.slate};
color: ${props => props.theme.textSecondary};
padding: 2px 0;
line-height: 16px;
text-align: center;
Expand All @@ -140,7 +140,7 @@ const Caption = styled.input`
background: none;
&::placeholder {
color: ${props => props.theme.slate};
color: ${props => props.theme.placeholder};
}
`;

Expand Down
4 changes: 2 additions & 2 deletions src/components/InlineCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const InlineCode = styled.code.attrs({
spellCheck: false,
})`
padding: 0.15em;
background: ${props => props.theme.smoke};
background: ${props => props.theme.codeBackground};
border-radius: 4px;
border: 1px solid ${props => props.theme.smokeDark};
border: 1px solid ${props => props.theme.codeBorder};
`;

export default InlineCode;
2 changes: 1 addition & 1 deletion src/components/TodoItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ListItem = styled.li`
position: relative;
> p > span {
color: ${props => (props.checked ? props.theme.slateDark : "inherit")};
color: ${props => (props.checked ? props.theme.textSecondary : "inherit")};
text-decoration: ${props => (props.checked ? "line-through" : "none")};
}
`;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Toolbar/BlockToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class BlockToolbar extends React.Component<Props> {
const Separator = styled.div`
height: 100%;
width: 1px;
background: ${props => props.theme.smokeDark};
background: rgba(0, 0, 0, 0.1);
display: inline-block;
margin-left: 10px;
`;
Expand All @@ -193,7 +193,7 @@ const Bar = styled(Flex)`
animation: ${fadeIn} 150ms ease-in-out;
position: relative;
align-items: center;
background: ${props => props.theme.smoke};
background: ${props => props.theme.blockToolbarBackground};
height: 44px;
&:before,
Expand All @@ -203,7 +203,7 @@ const Bar = styled(Flex)`
left: -100%;
width: 100%;
height: 44px;
background: ${props => props.theme.smoke};
background: ${props => props.theme.blockToolbarBackground};
}
&:after {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Toolbar/LinkSearchResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const ListItem = styled.a`
align-items: center;
height: 28px;
padding: 6px 8px 6px 0;
color: ${props => props.theme.white};
color: ${props => props.theme.toolbarItem};
font-family: ${props => props.theme.fontFamily};
font-size: 15px;
text-decoration: none;
Expand Down
6 changes: 3 additions & 3 deletions src/components/Toolbar/LinkToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export default class LinkToolbar extends React.Component<Props, State> {
}

const SearchResults = styled.div`
background: ${props => props.theme.blackLight};
background: ${props => props.theme.toolbarBackground};
position: absolute;
top: 100%;
width: 100%;
Expand All @@ -256,12 +256,12 @@ const LinkEditor = styled(Flex)`

const Input = styled.input`
font-size: 15px;
background: rgba(255, 255, 255, 0.1);
background: ${props => props.theme.toolbarInput};
border-radius: 2px;
padding: 4px 8px;
border: 0;
margin: 0;
outline: none;
color: ${props => props.theme.white};
color: ${props => props.theme.toolbarItem};
flex-grow: 1;
`;
2 changes: 1 addition & 1 deletion src/components/Toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ const Menu = styled.div`
top: -10000px;
left: -10000px;
opacity: 0;
background-color: ${props => props.theme.blackLight};
background-color: ${props => props.theme.toolbarBackground};
border-radius: 4px;
transform: scale(0.95);
transition: opacity 150ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ const StyledEditor = styled(Editor)`
}
blockquote {
border-left: 3px solid ${props => props.theme.slateLight};
border-left: 3px solid ${props => props.theme.quote};
margin: 0;
padding-left: 10px;
font-style: italic;
Expand Down
23 changes: 14 additions & 9 deletions src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@ const theme = {
fontFamily:
"-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen, Ubuntu,Cantarell,'Open Sans','Helvetica Neue',sans-serif",
fontWeight: 400,
background: "#FFF",

text: "#171B35",
textSecondary: "#4E5C6E",
textLight: "#FFF",
link: "#1AB6FF",
primary: "#1AB6FF",
placeholder: "#b1becc",

slate: "#9BA6B2",
slateLight: "#DAE1E9",
slateDark: "#4E5C6E",
toolbarBackground: "#2F3336",
toolbarInput: "rgba(255, 255, 255, 0.1)",
toolbarItem: "#FFF",

smoke: "#F4F7FA",
smokeLight: "#F9FBFC",
smokeDark: "#E8EBED",
blockToolbarBackground: "#F4F7FA",
blockToolbarTrigger: "#9BA6B2",
blockToolbarTriggerIcon: "#FFF",

white: "#FFFFFF",
black: "#000000",
blackLight: "#2f3336",
quote: "#DAE1E9",
selected: "#1AB6FF",
codeBackground: "#F4F7FA",
codeBorder: "#E8EBED",
horizontalRule: "#E8EBED",
};

export default theme;

0 comments on commit 3c1d577

Please sign in to comment.