Skip to content

Commit

Permalink
design: Add default theme
Browse files Browse the repository at this point in the history
  • Loading branch information
gaori committed Sep 9, 2023
1 parent 22aee7e commit 2f5e34c
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 15 deletions.
37 changes: 37 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"devDependencies": {
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@types/styled-components": "^5.1.26",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react-swc": "^3.3.2",
Expand Down
10 changes: 1 addition & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import { RecoilRoot } from 'recoil';
import Home from './pages/Home';

function App() {
return (
<RecoilRoot>
{/* 아래에 각각의 페이지 */}
<Home />
</RecoilRoot>
);
return <></>;
}

export default App;
5 changes: 5 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
9 changes: 8 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,16 @@ import ReactDOM from 'react-dom/client';
import './index.css';
import { RouterProvider } from 'react-router-dom';
import { router } from './routes/router';
import { RecoilRoot } from 'recoil';
import { ThemeProvider } from 'styled-components';
import theme from './styles/theme';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<RouterProvider router={router} />
<RecoilRoot>
<ThemeProvider theme={theme}>
<RouterProvider router={router} />
</ThemeProvider>
</RecoilRoot>
</React.StrictMode>,
);
5 changes: 0 additions & 5 deletions src/pages/Home.tsx

This file was deleted.

9 changes: 9 additions & 0 deletions src/styles/styled.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'styled-components';
import { ColorType, FontSizeType } from './theme';

declare module 'styled-components' {
export interface DefaultTheme {
colors: ColorType;
fontSize: FontSizeType;
}
}
25 changes: 25 additions & 0 deletions src/styles/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { DefaultTheme } from 'styled-components';

const colors = {
// primary:
// secondary:
border: '#f2f2f2',
white: '#ffffff',
black: '#1D1B26',
};

const fontSize = {
title: 20,
subTitle: 16,
text: 14,
};

export type ColorType = typeof colors;
export type FontSizeType = typeof fontSize;

const theme: DefaultTheme = {
colors,
fontSize,
};

export default theme;

0 comments on commit 2f5e34c

Please sign in to comment.