refactor: colours

This commit is contained in:
2021-01-30 16:35:56 +00:00
parent e2a63de94b
commit 1cc86aa86f
13 changed files with 75 additions and 41 deletions

View File

@@ -16,7 +16,7 @@ const Button = styled.button`
`} `}
z-index: 2; z-index: 2;
background-color: transparent; background-color: transparent;
color: var(--theme-color-dark); color: var(--color-dark);
border: none; border: none;
margin: 0; margin: 0;
padding: 0; padding: 0;

View File

@@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { css } from "@emotion/react"; import { css } from "@emotion/react";
import { Grid, IconWithContent, Icon, Link } from "."; import { Grid, IconWithContent, Icon, Link, Text } from ".";
import Envelope from "../icons/envelope.svg"; import Envelope from "../icons/envelope.svg";
import Phone from "../icons/phone.svg"; import Phone from "../icons/phone.svg";
@@ -11,7 +11,7 @@ const Container = styled.footer`
`; `;
const Content = styled.div` const Content = styled.div`
max-width: var(--theme-max-width); max-width: var(--page-max-width);
margin: 0 auto; margin: 0 auto;
padding: var(--spacing-y-lg) var(--spacing-x-sm); padding: var(--spacing-y-lg) var(--spacing-x-sm);
font-size: var(--font-size-sm); font-size: var(--font-size-sm);
@@ -60,7 +60,7 @@ export default function Footer() {
</IconWithContent> </IconWithContent>
</Cell> </Cell>
</Grid> </Grid>
<div>&copy; {year} Abc Project Ltd</div> <Text size="xs">&copy; {year} Abc Project Ltd</Text>
</Content> </Content>
</Container> </Container>
); );

View File

@@ -20,11 +20,11 @@ const Top = styled.div`
transform 0.5s ease-in 0.5s; transform 0.5s ease-in 0.5s;
path:first-of-type { path:first-of-type {
fill: var(--theme-color-primary); fill: var(--color-primary);
} }
path:last-of-type { path:last-of-type {
fill: var(--theme-color-secondary); fill: var(--color-secondary);
} }
${props => ${props =>
@@ -56,11 +56,11 @@ const Bottom = styled.div`
transform 0.5s ease-in 0.5s; transform 0.5s ease-in 0.5s;
path:first-of-type { path:first-of-type {
fill: var(--theme-color-dark); fill: var(--color-dark);
} }
path:last-of-type { path:last-of-type {
fill: var(--theme-color-secondary); fill: var(--color-secondary);
} }
${props => ${props =>
@@ -81,8 +81,13 @@ export default function HeaderLogo({ transition }) {
<LogoArrows /> <LogoArrows />
</Top> </Top>
<Middle visible={visible}> <Middle visible={visible}>
<Heading withShadow noMargin noWrap> <Heading
Abc Project Design Ltd shadowRadius="15px"
shadowColor="rgba(255, 255, 255, 0.25)"
noMargin
noWrap
>
ABC Project Design Ltd
</Heading> </Heading>
<Text size="lg" noMargin> <Text size="lg" noMargin>
Easy as ABC Easy as ABC

View File

@@ -35,7 +35,7 @@ const Content = styled.div`
${props => (props.posX === "middle" ? "-50%" : 0)}, ${props => (props.posX === "middle" ? "-50%" : 0)},
${props => (props.posY === "middle" ? "-50%" : 0)} ${props => (props.posY === "middle" ? "-50%" : 0)}
); );
max-width: var(--theme-max-width); max-width: var(--page-max-width);
padding: var(--spacing-y-sm) var(--spacing-x-sm); padding: var(--spacing-y-sm) var(--spacing-x-sm);
text-align: center; text-align: center;
`; `;

View File

@@ -5,16 +5,18 @@ import { css } from "@emotion/react";
const Styles = styled.h1` const Styles = styled.h1`
margin: ${props => (props.noMargin ? 0 : `0 0 var(--spacing-y-sm)`)}; margin: ${props => (props.noMargin ? 0 : `0 0 var(--spacing-y-sm)`)};
font-size: ${props => `var(--font-size-${props.size})`}; font-size: ${props => `var(--font-size-${props.size})`};
text-shadow: 0 0 ${props => props.shadowRadius || `2px`}
${props => props.shadowColor || `rgba(0, 0, 0, 0.25)`};
${props =>
props.color &&
css`
color: var(--color-${props.color});
`}
${props => ${props =>
props.noWrap && props.noWrap &&
css` css`
white-space: nowrap; white-space: nowrap;
`} `}
${props =>
props.withShadow &&
css`
text-shadow: 0 0 12px rgba(0, 0, 0, 0.5);
`};
`; `;
const sizes = { const sizes = {

View File

@@ -1,11 +1,16 @@
import React from "react"; import React from "react";
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { css } from "@emotion/react";
const Container = styled.span` const Container = styled.span`
display: inline-block; display: inline-block;
width: ${props => `var(--icon-size-${props.size})`}; width: ${props => `var(--icon-size-${props.size})`};
height: ${props => `var(--icon-size-${props.size})`}; height: ${props => `var(--icon-size-${props.size})`};
color: ${props => `var(--theme-color-${props.color})`}; ${props =>
props.color &&
css`
color: var(--color-${props.color});
`}
svg { svg {
width: 100%; width: 100%;

View File

@@ -15,7 +15,7 @@ const Input = styled.input`
width: 100%; width: 100%;
margin-bottom: var(--spacing-y-sm); margin-bottom: var(--spacing-y-sm);
padding: var(--spacing-y-xs) var(--spacing-x-sm); padding: var(--spacing-y-xs) var(--spacing-x-sm);
border: 1px solid var(--theme-color-dark); border: 1px solid var(--color-dark);
`; `;
export default function InputText({ export default function InputText({

View File

@@ -1,10 +1,19 @@
import React from "react"; import React from "react";
import styled from "@emotion/styled"; import styled from "@emotion/styled";
import { css } from "@emotion/react";
import { Link as GatsbyLink } from "gatsby"; import { Link as GatsbyLink } from "gatsby";
const StyledLink = styled.a` const StyledLink = styled.a`
font-size: ${props => `var(--font-size-${props.size})`}; ${props =>
color: ${props => `var(--theme-color-${props.color})`}; props.size &&
css`
font-size: var(--font-size-${props.size});
`}
${props =>
props.color &&
css`
color: var(--theme-color-${props.color});
`}
text-decoration: none; text-decoration: none;
`; `;

View File

@@ -32,7 +32,7 @@ const Wrapper = styled.div`
display: flex; display: flex;
flex-direction: column-reverse; flex-direction: column-reverse;
height: 100%; height: 100%;
max-width: var(--theme-max-width); max-width: var(--page-max-width);
margin: 0 auto; margin: 0 auto;
@media (min-width: 30em) { @media (min-width: 30em) {
flex-direction: row; flex-direction: row;
@@ -60,21 +60,21 @@ const Heading = styled(Link)`
&:first-of-type { &:first-of-type {
path:first-of-type { path:first-of-type {
fill: var(--theme-color-primary); fill: var(--color-primary);
} }
path:last-of-type { path:last-of-type {
fill: var(--theme-color-secondary); fill: var(--color-secondary);
} }
} }
&:last-of-type { &:last-of-type {
transform: rotate(180deg); transform: rotate(180deg);
path:first-of-type { path:first-of-type {
fill: var(--theme-color-dark); fill: var(--color-dark);
} }
path:last-of-type { path:last-of-type {
fill: var(--theme-color-secondary); fill: var(--color-secondary);
} }
} }
} }

View File

@@ -49,7 +49,7 @@ const Quote = styled.div`
position: absolute; position: absolute;
width: 24px; width: 24px;
height: 24px; height: 24px;
color: var(--theme-color-dark); color: var(--color-dark);
&:first-of-type { &:first-of-type {
top: 0; top: 0;
@@ -67,7 +67,7 @@ const Quote = styled.div`
const Title = styled.p` const Title = styled.p`
font-weight: bold; font-weight: bold;
color: var(--theme-color-dark); color: var(--color-dark);
`; `;
const SmallIcon = styled.span` const SmallIcon = styled.span`
@@ -75,7 +75,7 @@ const SmallIcon = styled.span`
width: 16px; width: 16px;
height: 16px; height: 16px;
margin-right: var(--spacing-x-sm); margin-right: var(--spacing-x-sm);
color: var(--theme-color-dark); color: var(--color-dark);
svg { svg {
width: 100%; width: 100%;

View File

@@ -6,15 +6,14 @@ const Container = styled.div`
padding: var(--spacing-y-lg) var(--spacing-x-sm); padding: var(--spacing-y-lg) var(--spacing-x-sm);
${props => !props.variant && `background-color: var(--color-white);`} ${props => !props.variant && `background-color: var(--color-white);`}
${props => ${props =>
props.variant === "primary" && props.variant === "primary" && `background-color: var(--color-light);`}
`background-color: var(--theme-color-light);`}
${props => ${props =>
props.variant === "transparent" && props.variant === "transparent" &&
`background-color: var(--color-semi-transparent);`} `background-color: var(--color-semi-transparent);`}
`; `;
const Content = styled.div` const Content = styled.div`
max-width: var(--theme-max-width); max-width: var(--page-max-width);
margin: 0 auto; margin: 0 auto;
`; `;

View File

@@ -14,10 +14,22 @@ const StyledText = styled.p`
css` css`
text-align: ${props.align}; text-align: ${props.align};
`} `}
font-size: ${props => `var(--font-size-${props.size})`}; ${props =>
color: ${props => `var(--theme-color-${props.color})`}; props.size &&
css`
font-size: var(--font-size-${props.size});
`}
${props =>
props.color &&
css`
color: var(--color-${props.color});
`}
`; `;
export default function Text({ children, ...props }) { export default function Text({ children, ...props }) {
return <StyledText {...props}>{children}</StyledText>; return (
<StyledText {...props}>
{children}
</StyledText>
);
} }

View File

@@ -9,20 +9,21 @@ import "@fontsource/cooper-hewitt/700.css";
const GlobalStyles = css` const GlobalStyles = css`
:root { :root {
--theme-max-width: 960px; --page-max-width: 960px;
--theme-color-primary: #9c0905; --color-primary: #9c0905;
--theme-color-secondary: #9590a8; --color-secondary: #9590a8;
--theme-color-tertiary: #bbcbcb; --color-tertiary: #bbcbcb;
--theme-color-light: #e5ffde; --color-light: #e5ffde;
--theme-color-dark: #000a61; --color-dark: #000a61;
--color-black: #000; --color-black: #000;
--color-white: #fff; --color-white: #fff;
--color-light-grey: #ced; --color-light-grey: #ced;
--color-mid-grey: #606069; --color-mid-grey: #606069;
--color-dark-grey: #333; --color-dark-grey: #233;
--color-semi-transparent: rgba(255, 255, 255, 0.75); --color-semi-transparent: rgba(255, 255, 255, 0.75);
--base-font-size: 16px; --base-font-size: 16px;
--line-height: 1.6; --line-height: 1.6;
--font-size-xs: 0.75rem; // 12px
--font-size-sm: 0.875rem; // 14px --font-size-sm: 0.875rem; // 14px
--font-size-md: 1rem; // 16px --font-size-md: 1rem; // 16px
--font-size-lg: 1.125rem; // 18px --font-size-lg: 1.125rem; // 18px
@@ -67,6 +68,7 @@ const GlobalStyles = css`
margin: 0; margin: 0;
font-family: "Cooper Hewitt", sans-serif; font-family: "Cooper Hewitt", sans-serif;
line-height: var(--line-height); line-height: var(--line-height);
color: var(--color-dark-grey);
} }
*, *,