Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: react router v6 & pages integration #22

Merged
merged 8 commits into from
Mar 26, 2024
39 changes: 39 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"clsx": "^2.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3",
"tailwind-merge": "^2.2.1"
},
"devDependencies": {
Expand Down
17 changes: 4 additions & 13 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import derivLogo from './static/deriv-logo.svg';
import { RouterProvider } from 'react-router-dom';

import { router } from './routes';

import './App.css';

function App() {
return (
<div className='flex flex-col items-center justify-center gap-10'>
<a href='https://deriv.com' target='_blank' rel='noreferrer'>
<img src={derivLogo} className='h-[100px] w-[100px]' alt='Deriv logo' />
</a>
<h1 className='text-5xl font-bold'>Deriv V2</h1>
<button>Click me 💅</button>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
);
return <RouterProvider router={router} />;
}

export default App;
25 changes: 0 additions & 25 deletions src/__tests__/App.spec.tsx

This file was deleted.

10 changes: 10 additions & 0 deletions src/pages/compareAccounts/compareAccounts.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Link } from 'react-router-dom';

export const CompareAccounts = () => {
return (
<>
<h1>Compare Accounts</h1>
<Link to='/'>Go to Homepage</Link>
</>
);
};
1 change: 1 addition & 0 deletions src/pages/compareAccounts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { CompareAccounts } from './compareAccounts';
18 changes: 18 additions & 0 deletions src/pages/homepage/homepage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Link } from 'react-router-dom';

import derivLogo from '../../static/deriv-logo.svg';

export function Homepage() {
return (
<div className='flex flex-col items-center justify-center gap-10'>
<a href='https://deriv.com' target='_blank' rel='noreferrer'>
<img src={derivLogo} className='h-[100px] w-[100px]' alt='Deriv logo' />
</a>
<h1 className='text-5xl font-bold'>Deriv V2</h1>
<Link to='signup'>Click me 💅</Link>
<p>
Edit <code>src/App.tsx</code> and save to test HMR
</p>
</div>
);
}
1 change: 1 addition & 0 deletions src/pages/homepage/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Homepage } from './homepage';
3 changes: 3 additions & 0 deletions src/pages/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './homepage';
export * from './signup';
export * from './compareAccounts';
1 change: 1 addition & 0 deletions src/pages/signup/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Signup } from './signup';
10 changes: 10 additions & 0 deletions src/pages/signup/signup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Link } from 'react-router-dom';

export const Signup = () => {
return (
<>
<h1>Signup</h1>
<Link to='/'>Go to Homepage</Link>
</>
);
};
1 change: 1 addition & 0 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { router } from './routes';
18 changes: 18 additions & 0 deletions src/routes/routes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { createBrowserRouter } from 'react-router-dom';

import { CompareAccounts, Homepage, Signup } from '../pages';

export const router = createBrowserRouter([
{
path: '/',
element: <Homepage />,
},
{
path: '/signup',
element: <Signup />,
},
{
path: '/compare-accounts',
element: <CompareAccounts />,
},
]);
Loading