Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DEV-17): add react-router support
failing test
- Loading branch information
Showing
8 changed files
with
168 additions
and
14 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare module "*.css" |
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,10 +1,15 @@ | ||
import * as React from 'react'; | ||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; | ||
import { Home } from './Home'; | ||
import { Page1 } from './Page1'; | ||
import { Page2 } from './Page2'; | ||
|
||
const App = () => { | ||
return ( | ||
<h1> | ||
Hello React in TypeScript + Jest + React Testing Library + Storybook | ||
</h1> | ||
); | ||
}; | ||
const App = () => (<Router> | ||
<Switch> | ||
<Route path='/' exact component={Home} /> | ||
<Route path='/page1' component={Page1} /> | ||
<Route path='/page2' component={Page2} /> | ||
</Switch> | ||
</Router> | ||
); | ||
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,17 @@ | ||
import React, { Fragment } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
import './styles.css'; | ||
|
||
export const Home = () => { | ||
return ( | ||
<Fragment> | ||
<h1> | ||
Hello React in TypeScript + Jest + React Testing Library + Storybook | ||
</h1> | ||
<div className={'links'}> | ||
<Link to={'/page1'}>Link to Page 1</Link> | ||
<Link to={'/page2'}>Link to Page 2</Link> | ||
</div> | ||
</Fragment> | ||
); | ||
}; |
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 @@ | ||
.links { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.links > :first-child { | ||
margin-bottom: 10px; | ||
} |
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, { Fragment } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const Page1 = () => ( | ||
<Fragment> | ||
<h1>This is page 1</h1> | ||
<Link to={'/'}>Go to Home</Link> | ||
</Fragment> | ||
); |
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, { Fragment } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export const Page2 = () => ( | ||
<Fragment> | ||
<h1>This is page 2</h1> | ||
<Link to={'/'}>Go to Home</Link> | ||
</Fragment> | ||
) |
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