-
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.
Merge pull request #15 from Laina-Protocol/feat/use-react-for-frontend
feat: Convert frontend components to use React.
- Loading branch information
Showing
24 changed files
with
341 additions
and
342 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export interface ButtonProps { | ||
onClick: () => void; | ||
className?: string; | ||
} | ||
|
||
export const Button = ({ onClick, className = '', children }: PropsWithChildren<ButtonProps>) => ( | ||
<button | ||
type="button" | ||
onClick={onClick} | ||
className={`bg-black text-white rounded-full px-8 py-2 hover:bg-grey-dark transition ${className}`} | ||
> | ||
{children} | ||
</button> | ||
); | ||
|
||
export const SelectButtonWrapper = ({ children }: PropsWithChildren) => ( | ||
<div className="flex bg-grey p-1 gap-2 rounded-full">{children}</div> | ||
); | ||
|
||
export interface SelectLinkButtonProps { | ||
to: string; | ||
selected: boolean; | ||
} | ||
|
||
export const SelectLinkButton = ({ to, selected, children }: PropsWithChildren<SelectLinkButtonProps>) => ( | ||
<Link | ||
className={`font-bold px-6 py-1.5 rounded-full hover:text-black transition ${selected ? 'bg-white text-black' : 'text-white'}`} | ||
to={to} | ||
> | ||
{children} | ||
</Link> | ||
); |
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,9 @@ | ||
import type { PropsWithChildren } from 'react'; | ||
|
||
export interface CardProps { | ||
className?: string; | ||
} | ||
|
||
export const Card = ({ className = '', children }: PropsWithChildren<CardProps>) => ( | ||
<div className={`bg-white rounded drop-shadow ${className}`}>{children}</div> | ||
); |
Empty file.
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.