chore: migrate from styled-components to emotion

This commit is contained in:
2021-01-20 20:56:39 +00:00
parent eba8b769a2
commit 2febe92029
22 changed files with 199 additions and 114 deletions

View File

@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
const Container = styled.button`
background-color: transparent;

View File

@@ -1,7 +1,7 @@
import React from "react";
import { Link as GatsbyLink } from "gatsby";
import Img from "gatsby-image";
import styled from "styled-components";
import styled from "@emotion/styled";
const Container = styled.div`
display: flex;

View File

@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
const Container = styled.div`
transform: ${props =>

View File

@@ -1,6 +1,7 @@
import React, { useEffect, useRef } from "react";
import Slick from "react-slick";
import styled, { css } from "styled-components";
import styled from "@emotion/styled";
import { css } from "@emotion/react";
import LeftArrow from "../icons/left-arrow.svg";
import RightArrow from "../icons/right-arrow.svg";
import "slick-carousel/slick/slick.css";

View File

@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
const Container = styled.footer`
background-color: var(--color-white);

View File

@@ -1,5 +1,6 @@
import React, { useEffect, useState } from "react";
import styled, { css } from "styled-components";
import styled from "@emotion/styled";
import { css } from "@emotion/react";
import LogoArrows from "../icons/logo-arrows.svg";
const Container = styled.div`

View File

@@ -1,6 +1,6 @@
import React from "react";
import Img from "gatsby-image";
import styled from "styled-components";
import styled from "@emotion/styled";
const Container = styled.header`
position: relative;
@@ -29,7 +29,7 @@ export default function Header({ image, children }) {
/*
import React, { useState } from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
import MenuButton from "./menu-button";
import Nav from "./nav";

View File

@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
import { Icon } from "./";
const Container = styled.div`

View File

@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
const Container = styled.span`
display: inline-block;

View File

@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
const Container = styled.div`
max-width: 320px;

View File

@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
import { Link as GatsbyLink } from "gatsby";
const StyledLink = styled.a`

View File

@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
const Container = styled.button`
position: relative;

View File

@@ -1,5 +1,6 @@
import React from "react";
import styled, { css } from "styled-components";
import styled from "@emotion/styled";
import { css } from "@emotion/react";
import NavLink from "./nav-link";
const SubList = styled.ul`

View File

@@ -1,6 +1,6 @@
import React from "react";
import { Link as GatsbyLink } from "gatsby";
import styled from "styled-components";
import styled from "@emotion/styled";
const Link = styled(GatsbyLink)`
display: inline-block;

View File

@@ -1,6 +1,6 @@
import React from "react";
import { Link } from "gatsby";
import styled from "styled-components";
import styled from "@emotion/styled";
import NavItem from "./nav-item";
import MenuButton from "./menu-button";
import LogoArrows from "../icons/logo-arrows.svg";

View File

@@ -1,5 +1,5 @@
import React from "react";
import styled from "styled-components";
import styled from "@emotion/styled";
import Text from "./text";
import RatedPeople from "../icons/rated-people.svg";
import Bark from "../icons/bark.svg";

View File

@@ -1,5 +1,6 @@
import React from "react";
import styled, { css } from "styled-components";
import styled from "@emotion/styled";
import { css } from "@emotion/react";
const Container = styled.div`
padding: var(--spacing-y-lg) var(--spacing-x-sm);

View File

@@ -1,5 +1,6 @@
import React from "react";
import styled, { css } from "styled-components";
import styled from "@emotion/styled";
import { css } from "@emotion/react";
const StyledText = styled.p`
margin-bottom: var(--spacing-y-xs);

View File

@@ -2,12 +2,12 @@ import React, { useState } from "react";
import { useStaticQuery, graphql } from "gatsby";
import { Helmet } from "react-helmet";
import { Footer, Nav } from "./components";
import { createGlobalStyle } from "styled-components";
import { css, Global } from "@emotion/react";
import "@fontsource/cooper-hewitt/400.css";
import "@fontsource/cooper-hewitt/400-italic.css";
import "@fontsource/cooper-hewitt/700.css";
const GlobalStyle = createGlobalStyle`
const GlobalStyles = css`
:root {
--theme-max-width: 960px;
--theme-color-primary: #9c0905;
@@ -66,12 +66,13 @@ const GlobalStyle = createGlobalStyle`
body {
box-sizing: border-box;
margin: 0;
font-family: 'Cooper Hewitt', sans-serif;
font-family: "Cooper Hewitt", sans-serif;
overflow-x: hidden;
overflow-y: ${props => (props.navOpen ? "hidden" : "auto")};
}
*, *:before, *:after {
*,
*:before,
*:after {
box-sizing: inherit;
}
@@ -108,7 +109,6 @@ export default function Layout({ children }) {
`);
const { title, description, keywords, navData } = data.site.siteMetadata;
const [navOpen, setNavOpen] = useState();
const [loaded, setLoaded] = useState();
return (
<>
<main>
@@ -121,17 +121,21 @@ export default function Layout({ children }) {
htmlAttributes={{
lang: "en"
}}
onChangeClientState={() => setLoaded(true)}
/>
<GlobalStyle navOpen={navOpen} />
{loaded && (
<>
{children}
<Footer />
</>
)}
<Global styles={GlobalStyles} />
<Global
styles={
navOpen && {
body: {
"overflow-y": "hidden"
}
}
}
/>
{children}
<Footer />
</main>
{loaded && <Nav data={navData} open={navOpen} setOpen={setNavOpen} />}
<Nav data={navData} open={navOpen} setOpen={setNavOpen} />
</>
);
}