-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make a self-contained SPA using react-router-dom.
- Loading branch information
Showing
18 changed files
with
180 additions
and
87 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,39 @@ | ||
import React from 'react'; | ||
import { Outlet, RouterProvider, createBrowserRouter } from 'react-router-dom'; | ||
|
||
import Nav from '@components/Nav'; | ||
import BorrowPage from '@pages/borrow/BorrowPage'; | ||
import LandingPage from '@pages/landing/LandingPage'; | ||
import LendPage from '@pages/lend/LendPage'; | ||
import LiquidatePage from '@pages/liquidate/LiquidatePage'; | ||
|
||
const PageWrapper = () => ( | ||
<> | ||
<Nav /> | ||
<main className="max-w-screen w-256"> | ||
<Outlet /> | ||
</main> | ||
</> | ||
); | ||
|
||
const router = createBrowserRouter([ | ||
{ | ||
element: <PageWrapper />, | ||
children: [ | ||
{ path: '', element: <LandingPage /> }, | ||
{ path: 'lend', element: <LendPage /> }, | ||
{ path: 'borrow', element: <BorrowPage /> }, | ||
{ path: 'liquidate', element: <LiquidatePage /> }, | ||
], | ||
}, | ||
]); | ||
|
||
const App = () => { | ||
return ( | ||
<React.StrictMode> | ||
<RouterProvider router={router} /> | ||
</React.StrictMode> | ||
); | ||
}; | ||
|
||
export default App; |
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,3 +1,4 @@ | ||
/// <reference path="../.astro/types.d.ts" /> | ||
/// <reference types="astro/client" /> | ||
|
||
interface ImportMetaEnv { | ||
|
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,19 @@ | ||
--- | ||
import App from '../App.tsx'; | ||
import Layout from '../layouts/Layout.astro'; | ||
export function getStaticPaths() { | ||
return [ | ||
{ params: { path: undefined }, props: { title: 'Laina – DeFi made simple.' } }, | ||
{ params: { path: 'lend' }, props: { title: 'Laina – Lend assets' } }, | ||
{ params: { path: 'borrow' }, props: { title: 'Laina – Borrow assets' } }, | ||
{ params: { path: 'liquidate' }, props: { title: 'Laina – Liquidate loans' } }, | ||
]; | ||
} | ||
const { title } = Astro.props; | ||
--- | ||
|
||
<Layout title={title}> | ||
<App client:only /> | ||
</Layout> |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
const BorrowPage = () => ( | ||
<div> | ||
<h1 className="text-3xl font-bold mb-8">Borrow Assets</h1> | ||
<p>Coming soon!</p> | ||
</div> | ||
); | ||
|
||
export default BorrowPage; |
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
const LandingPage = () => ( | ||
<div> | ||
<h1 className="text-3xl font-bold mb-8">Landing page</h1> | ||
<p>Coming soon!</p> | ||
</div> | ||
); | ||
|
||
export default LandingPage; |
This file was deleted.
Oops, something went wrong.
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 StellarIcon from '../../images/Stellar_Symbol.png'; | ||
import USDCIcon from '../../images/usdc.svg'; | ||
import { LendableAssetCard } from './LendableAssetCard'; | ||
|
||
const currencies = [ | ||
{ | ||
name: 'USD Coin', | ||
symbol: 'USDC', | ||
icon: USDCIcon.src, | ||
}, | ||
{ | ||
name: 'Stellar Lumen', | ||
symbol: 'XLM', | ||
icon: StellarIcon.src, | ||
}, | ||
]; | ||
|
||
const LendPage = () => { | ||
return ( | ||
<> | ||
<h1 className="text-3xl font-bold mb-8">Lend Assets</h1> | ||
{currencies.map(({ name, symbol, icon }) => ( | ||
<LendableAssetCard key={name} name={name} symbol={symbol} icon={icon} /> | ||
))} | ||
</> | ||
); | ||
}; | ||
|
||
export default LendPage; |
4 changes: 2 additions & 2 deletions
4
src/components/LendableAssetCard.tsx → src/pages/lend/LendableAssetCard.tsx
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 was deleted.
Oops, something went wrong.
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,8 @@ | ||
const LiquidatePage = () => ( | ||
<div> | ||
<h1 className="text-3xl font-bold mb-8">Available for Liquidation</h1> | ||
<p>Coming soon!</p> | ||
</div> | ||
); | ||
|
||
export default LiquidatePage; |
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