Skip to content

Commit

Permalink
feat: add react-router and i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
yarre-uk committed Oct 26, 2023
1 parent 25ed5f6 commit e8523a7
Show file tree
Hide file tree
Showing 8 changed files with 1,750 additions and 1,662 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
"preview": "vite preview"
},
"dependencies": {
"i18next": "^23.5.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^13.3.0",
"react-router-dom": "^6.16.0",
"styled-components": "^6.1.0"
},
Expand Down
19 changes: 15 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
import { AppStyled, HelloWorldStyled } from './AppStyles';
import { Link, Route, Routes } from 'react-router-dom';
import { HashRouterStyled, HelloWorldStyled, LinkSegment } from './AppStyles';
import { Home, SignIn, SignUp } from './pages';

function App() {
return (
<AppStyled>
<HashRouterStyled>
<HelloWorldStyled>Hello World</HelloWorldStyled>
<HelloWorldStyled>Hello World</HelloWorldStyled>
</AppStyled>
<LinkSegment>
<Link to={'/'}>Home</Link>
<Link to={'signin'}>SignIn</Link>
<Link to={'signup'}>SignUp</Link>
</LinkSegment>
<Routes>
<Route index path="/" element={<Home />} />
<Route path="signin" element={<SignIn />} />
<Route path="signup" element={<SignUp />} />
</Routes>
</HashRouterStyled>
);
}

Expand Down
8 changes: 7 additions & 1 deletion src/AppStyles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HashRouter } from 'react-router-dom';
import styled from 'styled-components';

export const AppStyled = styled.div`
export const HashRouterStyled = styled(HashRouter)`
width: 100%;
height: 100%;
display: flex;
Expand All @@ -9,6 +10,11 @@ export const AppStyled = styled.div`
flex-direction: column;
`;

export const LinkSegment = styled.div`
display: flex;
gap: 1rem;
`;

export const HelloWorldStyled = styled.p`
font-size: 2rem;
`;
9 changes: 9 additions & 0 deletions src/pages/Home.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function Home() {
return (
<div>
<p>Home</p>
</div>
);
}

export default Home;
9 changes: 9 additions & 0 deletions src/pages/SignIn.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function SignIn() {
return (
<div>
<p>Sign In</p>
</div>
);
}

export default SignIn;
9 changes: 9 additions & 0 deletions src/pages/SignUp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function SignUp() {
return (
<div>
<p>Sign Up</p>
</div>
);
}

export default SignUp;
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 { default as SignIn } from './SignIn';
export { default as SignUp } from './SignUp';
export { default as Home } from './Home';
3,353 changes: 1,696 additions & 1,657 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit e8523a7

Please sign in to comment.