-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0638a74
commit 3c08977
Showing
20 changed files
with
171 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,29 @@ | ||
import { GithubCorner } from '@components/github'; | ||
import React from 'react'; | ||
import { css as csl } from '@linaria/core'; | ||
import 'ress'; | ||
import 'unfonts.css'; | ||
import { RouterProvider } from 'react-router-dom'; | ||
|
||
function App() { | ||
return ( | ||
<> | ||
<p>Hello World.</p> | ||
<GithubCorner /> | ||
</> | ||
); | ||
} | ||
import { css, cx } from '@lib/css'; | ||
import { theme } from '@theme'; | ||
|
||
export default App; | ||
import { router } from './routing'; | ||
|
||
export const App = () => ( | ||
<React.StrictMode> | ||
<div | ||
className={cx( | ||
csl` | ||
${theme.decl.font.size.step0} | ||
${theme.decl.font.sansSerif.regular} | ||
`, | ||
css` | ||
${theme.page.body} | ||
${theme.definitions} | ||
`, | ||
)} | ||
> | ||
<RouterProvider router={router} /> | ||
</div> | ||
</React.StrictMode> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { css as csl } from '@linaria/core'; | ||
import 'ress'; | ||
import 'unfonts.css'; | ||
import { RouterProvider } from 'react-router-dom'; | ||
|
||
import { css, cx } from '@lib/css'; | ||
import { theme } from '@theme'; | ||
|
||
import { router } from './routing'; | ||
|
||
export const App = () => ( | ||
<React.StrictMode> | ||
<div | ||
className={cx( | ||
csl` | ||
${theme.decl.font.size.step0} | ||
${theme.decl.font.sansSerif.regular} | ||
`, | ||
css` | ||
${theme.page.body} | ||
${theme.definitions} | ||
`, | ||
)} | ||
> | ||
<RouterProvider router={router} /> | ||
</div> | ||
</React.StrictMode> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
import { Link } from 'react-router-dom'; | ||
|
||
// @ts-expect-error - required for loading the logo | ||
import logo from '../../../content/images/logo.png?w=130&format=webp'; | ||
|
||
import styles from './site_logo.styles'; | ||
|
||
export const SiteLogo = () => ( | ||
<p {...styles.root}> | ||
<a href="/"> | ||
<Link to="/"> | ||
<img src={logo} alt="Logo" /> | ||
</a> | ||
</Link> | ||
</p> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import { createBrowserRouter, RouterProvider } from 'react-router-dom'; | ||
|
||
import App from './App.tsx'; | ||
|
||
const router = createBrowserRouter([ | ||
{ | ||
path: '/', | ||
element: <App />, | ||
}, | ||
]); | ||
import { App } from './app'; | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<RouterProvider router={router} /> | ||
<App /> | ||
</React.StrictMode>, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Article as ArticleComponent } from '@pages/article'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
export const Article = () => { | ||
const params = useParams<'id'>(); | ||
return <ArticleComponent id={params.id || 'not-found'} />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { useEffect } from 'react'; | ||
import { Home } from '@pages/home'; | ||
import { Portfolio } from '@pages/portfolio'; | ||
import { createBrowserRouter, Outlet, useLocation } from 'react-router-dom'; | ||
|
||
import { Article } from './article'; | ||
|
||
const ScrollToTop = () => { | ||
// Extracts pathname property(key) from an object | ||
const { pathname } = useLocation(); | ||
|
||
// Automatically scrolls to top whenever pathname changes | ||
useEffect(() => { | ||
window.scrollTo(0, 0); | ||
}, [pathname]); | ||
|
||
return <Outlet />; | ||
}; | ||
|
||
export const router = createBrowserRouter([ | ||
{ | ||
element: <ScrollToTop />, | ||
children: [ | ||
{ | ||
path: '/', | ||
element: <Home />, | ||
}, | ||
{ | ||
path: '/portfolio', | ||
element: <Portfolio />, | ||
}, | ||
{ | ||
path: '/portfolio/:id', | ||
element: <Article />, | ||
}, | ||
], | ||
}, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.