Skip to content

Commit 5fca21c

Browse files
committed
ADD: tailwind.config.js;
Signed-off-by: HarmonySkull <[email protected]>
1 parent 89d220e commit 5fca21c

File tree

12 files changed

+1104
-7
lines changed

12 files changed

+1104
-7
lines changed

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12+
"axios": "^0.27.2",
1213
"react": "^18.2.0",
13-
"react-dom": "^18.2.0"
14+
"react-dom": "^18.2.0",
15+
"react-router-dom": "6"
1416
},
1517
"devDependencies": {
18+
"@tailwindcss/line-clamp": "^0.4.0",
19+
"@tailwindcss/typography": "^0.5.4",
1620
"@types/react": "^18.0.15",
1721
"@types/react-dom": "^18.0.6",
22+
"@typescript-eslint/eslint-plugin": "^5.30.6",
23+
"@typescript-eslint/parser": "^5.30.6",
1824
"@vitejs/plugin-react": "^2.0.0",
1925
"autoprefixer": "^10.4.7",
2026
"postcss": "^8.4.14",

src/assets/react.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { Outlet } from 'react-router-dom'
2+
3+
const CommonLayout = () => {
4+
return (
5+
<section>
6+
<Outlet />
7+
</section>
8+
)
9+
}
10+
11+
export default CommonLayout

src/components/layouts/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as CommonLayout } from './CommonLayout'

src/components/pages/HomePage.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { useState } from 'react'
2+
3+
import reactLogo from './assets/react.svg'
4+
5+
const HomePage = () => {
6+
const [count, setCount] = useState(0)
7+
8+
return (
9+
<div className='App'>
10+
<div>
11+
<a href='https://vitejs.dev' target='_blank' rel='noreferrer'>
12+
<img src='/vite.svg' className='logo' alt='Vite logo' />
13+
</a>
14+
<a href='https://reactjs.org' target='_blank' rel='noreferrer'>
15+
<img src={reactLogo} className='logo react' alt='React logo' />
16+
</a>
17+
</div>
18+
<h1>Vite + React</h1>
19+
<div className='card'>
20+
<button onClick={() => setCount((count) => count + 1)}>
21+
count is {count}
22+
</button>
23+
<p>
24+
Edit <code>src/App.tsx</code> and save to test HMR
25+
</p>
26+
</div>
27+
<p className='read-the-docs'>
28+
Click on the Vite and React logos to learn more
29+
</p>
30+
</div>
31+
)
32+
}
33+
34+
export default HomePage

src/components/pages/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as HomePage } from './HomePage'

src/router/CommonRouter.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { BrowserRouter, Route, Routes } from 'react-router-dom'
2+
3+
import { HomePage } from '../components/pages'
4+
import { CommonLayout } from '../components/layouts'
5+
6+
const CommonRouter = () => (
7+
<BrowserRouter>
8+
<Routes>
9+
<Route path='/' element={<CommonLayout />}>
10+
<Route index element={<HomePage />} />
11+
</Route>
12+
</Routes>
13+
</BrowserRouter>
14+
)
15+
16+
export default CommonRouter

src/styles/base/_tailwind.sass

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@tailwind base
2+
@tailwind components
3+
@tailwind screens
4+
@tailwind utilities

src/styles/globals.sass

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@import "./base/_tailwind.sass"
2+
3+
#root
4+
max-width: 1280px
5+
margin: 0 auto
6+
padding: 2rem
7+
text-align: center
8+
9+
10+
.logo
11+
height: 6em
12+
padding: 1.5em
13+
will-change: filter
14+
15+
.logo:hover
16+
filter: drop-shadow(0 0 2em #646cffaa)
17+
18+
.logo.react:hover
19+
filter: drop-shadow(0 0 2em #61dafbaa)
20+
21+
22+
@keyframes logo-spin
23+
from
24+
transform: rotate(0deg)
25+
26+
to
27+
transform: rotate(360deg)
28+
29+
30+
31+
@media (prefers-reduced-motion: no-preference)
32+
a:nth-of-type(2) .logo
33+
animation: logo-spin infinite 20s linear
34+
35+
36+
37+
.card
38+
padding: 2em
39+
40+
41+
.read-the-docs
42+
color: #888
43+

0 commit comments

Comments
 (0)