Skip to content

Commit b507f1a

Browse files
author
Adam Plesnik
committed
Add router, first pages, components
1 parent fb85804 commit b507f1a

File tree

9 files changed

+90
-11
lines changed

9 files changed

+90
-11
lines changed

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html lang="en">
2+
<html lang="en" class="scroll-smooth bg-zinc-50 text-zinc-950 dark:bg-gray-900 dark:text-gray-300">
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

docs/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13+
"localforage": "^1.10.0",
14+
"match-sorter": "^6.3.4",
1315
"react": "^18.2.0",
14-
"react-dom": "^18.2.0"
16+
"react-dom": "^18.2.0",
17+
"react-router-dom": "^6.22.3",
18+
"sort-by": "^0.0.2",
19+
"tailwindcss": "^3.4.3"
1520
},
1621
"devDependencies": {
1722
"@types/react": "^18.2.66",
@@ -24,7 +29,6 @@
2429
"eslint-plugin-react-hooks": "^4.6.0",
2530
"eslint-plugin-react-refresh": "^0.4.6",
2631
"postcss": "^8.4.38",
27-
"tailwindcss": "^3.4.3",
2832
"typescript": "^5.2.2",
2933
"vite": "^5.2.0"
3034
}

docs/src/App.tsx

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/src/layouts/MainLayout.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { PropsWithChildren } from 'react'
2+
import { ScrollRestoration } from 'react-router-dom'
3+
import Footer from '../partials/Footer'
4+
import PageBackground from '../partials/PageBackground'
5+
6+
function MainLayout({ children }: PropsWithChildren<MainLayoutProps>) {
7+
return (
8+
<div className="flex flex-col items-center justify-center">
9+
<PageBackground />
10+
<div className="relative z-10 w-full max-w-screen-lg p-8 md:p-16 lg:p-20">
11+
<div className="w-full">{children}</div>
12+
<Footer />
13+
</div>
14+
<ScrollRestoration />
15+
</div>
16+
)
17+
}
18+
19+
export interface MainLayoutProps {
20+
children: PropsWithChildren
21+
}
22+
23+
export default MainLayout

docs/src/main.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import React from 'react'
22
import ReactDOM from 'react-dom/client'
3-
import App from './App.tsx'
3+
import { RouterProvider, createBrowserRouter } from 'react-router-dom'
4+
import Home from './pages/Home.tsx'
45
import './index.css'
56

7+
const router = createBrowserRouter([
8+
{
9+
path: '/',
10+
element: <Home />,
11+
errorElement: <Home />,
12+
},
13+
])
14+
615
ReactDOM.createRoot(document.getElementById('root')!).render(
716
<React.StrictMode>
8-
<App />
17+
<RouterProvider router={router} />
918
</React.StrictMode>
1019
)

docs/src/pages/Home.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import MainLayout from '../layouts/MainLayout.tsx'
2+
3+
function Home() {
4+
return (
5+
<MainLayout>
6+
<div>Silence.</div>
7+
</MainLayout>
8+
)
9+
}
10+
11+
export default Home

docs/src/partials/Footer.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const Footer = () => {
2+
return (
3+
<div className="mt-16 flex w-full flex-col gap-4 border-t border-t-zinc-700 pt-4 text-xs sm:flex-row sm:justify-between">
4+
<span className="font-medium">Created by Adam Plesník, Bratislava, Slovakia</span>
5+
<div className="flex flex-col gap-2 sm:items-end">
6+
{/* <Link
7+
target="_blank"
8+
borderWidth="narrow"
9+
href="https://github.com/adamplesnik/tailwindcss-scroll-driven-animations"
10+
>
11+
github.com/tailwindcss-scroll-driven-animations
12+
</Link>
13+
<Link target="_blank" borderWidth="narrow" href="https://adamplesnik.com">
14+
adamplesnik.com
15+
</Link> */}
16+
</div>
17+
</div>
18+
)
19+
}
20+
21+
export default Footer
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const PageBackground = () => {
2+
return (
3+
<div
4+
className={
5+
'animate-translate-up timeline fixed left-0 top-0 h-[24rem] w-full ' +
6+
'bg-gradient-to-tr from-yellow-200/0 from-55% via-yellow-400/30 via-75% to-purple-800/80 to-[130%] ' +
7+
'lg:h-[42rem] ' +
8+
'dark:from-slate-700/0 dark:via-slate-700/30 dark:to-violet-950'
9+
}
10+
></div>
11+
)
12+
}
13+
14+
export default PageBackground

docs/tailwind.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/** @type {import('tailwindcss').Config} */
22
export default {
3-
content: ['./src/**/*.{js,ts,jsx,tsx}', './index.html'],
3+
content: {
4+
files: ['./src/**/*.{js,ts,jsx,tsx}', './index.html'],
5+
},
46
theme: {
57
extend: {},
68
},

0 commit comments

Comments
 (0)