Skip to content

Commit

Permalink
Merge pull request #1 from zoopi-palette/feat/emotion-setup
Browse files Browse the repository at this point in the history
Feat/emotion setup
  • Loading branch information
ghtea authored Apr 16, 2022
2 parents 902b3df + d8a9853 commit 9ba028d
Show file tree
Hide file tree
Showing 9 changed files with 386 additions and 202 deletions.
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

0 comments on commit 9ba028d

Please sign in to comment.