-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Account-v2] Shaheer / FEQ-1138 / Adds routing to account-v2 package (#…
…13065) * docs: text fix * feat: adds routing for account v2 * fix: updates react router dom version
- Loading branch information
1 parent
7a7322e
commit e0584fa
Showing
6 changed files
with
139 additions
and
1 deletion.
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
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
9 changes: 9 additions & 0 deletions
9
packages/account-v2/src/router/components/dummy-route/dummy-route.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
|
||
const DummyRoute = ({ path }: { path: string }) => ( | ||
<div className='text-body-lg'> | ||
Component for path <span className='font-bold'>{path}</span> | ||
</div> | ||
); | ||
|
||
export default DummyRoute; |
40 changes: 40 additions & 0 deletions
40
packages/account-v2/src/router/components/route-links/route-links.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from 'react'; | ||
import { BrowserRouter, NavLink, Redirect, Route, Switch } from 'react-router-dom'; | ||
import { defaultRoute, routes } from '../../constants/routesConfig'; | ||
|
||
const RouteLinks = () => ( | ||
<BrowserRouter> | ||
<div className='p-800 border-solid border-200 border-solid-slate-75 grid grid-cols-[1fr_4fr]'> | ||
<div className='p-400 flex flex-col bg-solid-slate-75 rounded-200'> | ||
{routes.map(route => ( | ||
<NavLink | ||
activeClassName='bg-solid-slate-100 border-solid border-l-200 border-l-solid-red-500 rounded-200 font-bold' | ||
className='text-body-md p-400' | ||
key={route.routePath} | ||
to={route.routePath} | ||
> | ||
{route.routeName} | ||
</NavLink> | ||
))} | ||
</div> | ||
<div className='p-400'> | ||
<Switch> | ||
{routes.map(route => { | ||
const Component = route.routeComponent; | ||
return ( | ||
<Route | ||
exact | ||
key={route.routePath} | ||
path={route.routePath} | ||
render={() => <Component path={route.routePath} />} | ||
/> | ||
); | ||
})} | ||
<Redirect from='/' to={defaultRoute} /> | ||
</Switch> | ||
</div> | ||
</div> | ||
</BrowserRouter> | ||
); | ||
|
||
export default RouteLinks; |
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,86 @@ | ||
import DummyRoute from '../components/dummy-route/dummy-route'; | ||
|
||
export const routes = [ | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Personal details', | ||
routePath: '/account-v2/personal_details', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Languages', | ||
routePath: '/account-v2/languages', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Trading assessment', | ||
routePath: '/account-v2/trading_assessment', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Financial assessment', | ||
routePath: '/account-v2/financial_assessment', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Proof of identity', | ||
routePath: '/account-v2/proof_of_identity', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Proof of address', | ||
routePath: '/account-v2/proof_of_address', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Proof of ownership', | ||
routePath: '/account-v2/proof_of_ownership', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Proof of income', | ||
routePath: '/account-v2/proof_of_income', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Email and passwords', | ||
routePath: '/account-v2/email_and_passwords', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Self exclusion', | ||
routePath: '/account-v2/self_exclusion', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Account limits', | ||
routePath: '/account-v2/account_limits', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Login history', | ||
routePath: '/account-v2/login_history', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'API token', | ||
routePath: '/account-v2/api_token', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Connected apps', | ||
routePath: '/account-v2/connected_apps', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Two-factor authentication', | ||
routePath: '/account-v2/two_factor_authentication', | ||
}, | ||
{ | ||
routeComponent: DummyRoute, | ||
routeName: 'Close your account', | ||
routePath: '/account-v2/close_your_account', | ||
}, | ||
]; | ||
|
||
export const defaultRoute = routes[0].routePath; |
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
e0584fa
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
deriv-app – ./
deriv-app.binary.sx
binary.sx
deriv-app-git-master.binary.sx
deriv-app.vercel.app