Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/emotion setup #1

Merged
merged 5 commits into from
Apr 16, 2022
Merged
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
6 changes: 6 additions & 0 deletions .babelrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
presets: [
"next/babel",
],
plugins: ["@emotion"]
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
"ts-check": "tsc --project ./tsconfig.json"
},
"dependencies": {
"@emotion/react": "^11.9.0",
"emotion-reset": "^3.0.1",
"next": "12.1.4",
"react": "18.0.0",
"react-dom": "18.0.0"
},
"devDependencies": {
"@emotion/babel-plugin": "^11.9.2",
"@types/node": "17.0.23",
"@types/react": "18.0.1",
"@types/react-dom": "18.0.0",
Expand Down
10 changes: 8 additions & 2 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import "../styles/globals.css"
import type {AppProps} from "next/app"
import {GlobalStyle} from "styles/globalStyle"
import {ThemeProvider} from "styles/theme"

function MyApp({Component, pageProps}: AppProps) {
return <Component {...pageProps} />
return (
<ThemeProvider>
<GlobalStyle/>
<Component {...pageProps} />
</ThemeProvider>
)
}

export default MyApp
65 changes: 2 additions & 63 deletions pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,70 +1,9 @@
import type {NextPage} from "next"
import Head from "next/head"
import Image from "next/image"
import styles from "../styles/Home.module.css"

const Home: NextPage = () => {
return (
<div className={styles.container}>
<Head>
<title>Create Next App</title>
<meta name="description" content="Generated by create next app" />
<link rel="icon" href="/favicon.ico" />
</Head>

<main className={styles.main}>
<h1 className={styles.title}>
Welcome to <a href="https://nextjs.org">Next.js!</a>
</h1>

<p className={styles.description}>
Get started by editing{" "}
<code className={styles.code}>pages/index.tsx</code>
</p>

<div className={styles.grid}>
<a href="https://nextjs.org/docs" className={styles.card}>
<h2>Documentation &rarr;</h2>
<p>Find in-depth information about Next.js features and API.</p>
</a>

<a href="https://nextjs.org/learn" className={styles.card}>
<h2>Learn &rarr;</h2>
<p>Learn about Next.js in an interactive course with quizzes!</p>
</a>

<a
href="https://github.com/vercel/next.js/tree/canary/examples"
className={styles.card}
>
<h2>Examples &rarr;</h2>
<p>Discover and deploy boilerplate example Next.js projects.</p>
</a>

<a
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
className={styles.card}
>
<h2>Deploy &rarr;</h2>
<p>
Instantly deploy your Next.js site to a public URL with Vercel.
</p>
</a>
</div>
</main>

<footer className={styles.footer}>
<a
href="https://vercel.com?utm_source=create-next-app&utm_medium=default-template&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Powered by{" "}
<span className={styles.logo}>
<Image src="/vercel.svg" alt="Vercel Logo" width={72} height={16} />
</span>
</a>
</footer>
<div>
Home
</div>
)
}
Expand Down
116 changes: 0 additions & 116 deletions styles/Home.module.css

This file was deleted.

46 changes: 46 additions & 0 deletions styles/globalStyle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import {Global, css} from "@emotion/react"
import reset from "emotion-reset"

export const GlobalStyle = () => {
return (<Global styles={css`
${reset}
* {
box-sizing: border-box;
}
body {
width:100%;
overflow-x:hidden;
}

html {
font-size: 16px;
scroll-behavior: smooth;
width:100%;
overflow-x:hidden;
}

div, section, header, footer {
display: flex;
}

button {
border:none;
outline:none;
background: none;
box-shadow: none;
cursor: pointer;
}

a {
text-decoration: none;
}

input {
border:none;
outline:none;
:focus-visible{
outline: none;
}
}
`}/>)
}
16 changes: 0 additions & 16 deletions styles/globals.css

This file was deleted.

34 changes: 34 additions & 0 deletions styles/theme.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {ThemeProvider as EmotionThemeProvider, ThemeProviderProps} from "@emotion/react"

const palette = {
"grey-10": "#FDFDFD",
"grey-20": "#F7F8F9",
"grey-30": "#E9EBEE",
"grey-40": "#C5C8CE",
"grey-50": "#8B95A0",
"grey-60": "#646F7C",
"grey-70": "#374553",
"grey-80": "#28323C",
"grey-90": "#161D24",
}

const theme = {
colors: {
...palette,
main: "#FF3E3D",
sub: "#3B91F5",
error: "#FF6A3A",
success: "#4EC28A",
},
zIndex: {
modal: 100
}
}

export const ThemeProvider = ({children}: {children: React.ReactNode}) => {
return (
<EmotionThemeProvider theme={theme}>
{children}
</EmotionThemeProvider>
)
}
Loading