mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
add routing
This commit is contained in:
parent
e81fe4fac8
commit
73c6dc3ee8
4 changed files with 28 additions and 16 deletions
BIN
src/FilterLists.Web.V2/package-lock.json
generated
BIN
src/FilterLists.Web.V2/package-lock.json
generated
Binary file not shown.
|
|
@ -7,12 +7,14 @@
|
|||
"@types/node": "^12.7.2",
|
||||
"@types/react": "^16.9.2",
|
||||
"@types/react-dom": "^16.9.0",
|
||||
"@types/react-router-dom": "^4.3.5",
|
||||
"antd": "^3.22.0",
|
||||
"babel-plugin-import": "^1.12.0",
|
||||
"customize-cra": "^0.5.0",
|
||||
"react": "^16.9.0",
|
||||
"react-app-rewired": "^2.1.3",
|
||||
"react-dom": "^16.9.0",
|
||||
"react-router-dom": "^5.0.1",
|
||||
"react-scripts": "^3.1.1",
|
||||
"typescript": "3.5.3"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,25 +1,31 @@
|
|||
import { Layout, Menu } from 'antd';
|
||||
import React from 'react';
|
||||
import { BrowserRouter, Route, RouteComponentProps, Switch } from 'react-router-dom';
|
||||
|
||||
import { AllListsTable } from './components';
|
||||
|
||||
const { Header, Content, Footer } = Layout;
|
||||
|
||||
export const App: React.FC = () =>
|
||||
<Layout>
|
||||
<Header>
|
||||
<Logo />
|
||||
<Menu theme="dark" mode="horizontal" style={{ lineHeight: '64px' }} />
|
||||
</Header>
|
||||
<Content>
|
||||
<div style={{ background: '#fff', paddingLeft: 12, paddingTop: 12, paddingRight: 12, minHeight: 280 }}>
|
||||
<AllListsTable />
|
||||
</div>
|
||||
</Content>
|
||||
<Footer style={{ textAlign: 'center' }}>
|
||||
<CopyrightAuthor /> | <Community /> | <GitHub /> | <Api /> | <Donate />
|
||||
</Footer>
|
||||
</Layout>;
|
||||
<BrowserRouter>
|
||||
<Layout>
|
||||
<Header>
|
||||
<Logo />
|
||||
<Menu theme="dark" mode="horizontal" style={{ lineHeight: '64px' }} />
|
||||
</Header>
|
||||
<Content>
|
||||
<div style={{ background: '#fff', paddingLeft: 12, paddingTop: 12, paddingRight: 12, minHeight: 280 }}>
|
||||
<Switch>
|
||||
<Route path="/" exact component={AllListsTable} />
|
||||
<Route component={NotFound} />
|
||||
</Switch>
|
||||
</div>
|
||||
</Content>
|
||||
<Footer style={{ textAlign: 'center' }}>
|
||||
<CopyrightAuthor /> | <Community /> | <GitHub /> | <Api /> | <Donate />
|
||||
</Footer>
|
||||
</Layout>
|
||||
</BrowserRouter>;
|
||||
|
||||
const Logo = (): JSX.Element =>
|
||||
<img src="logo_filterlists.png"
|
||||
|
|
@ -62,4 +68,9 @@ const Donate = (): JSX.Element =>
|
|||
title="Donate to FilterLists with Beerpay"
|
||||
target="_blank" rel="noopener noreferrer">
|
||||
Donate
|
||||
</a>;
|
||||
</a>;
|
||||
|
||||
const NotFound = (props: RouteComponentProps) =>
|
||||
<h2>
|
||||
404 Not Found: <code>{props.location.pathname}</code>
|
||||
</h2>;
|
||||
|
|
@ -118,7 +118,6 @@ export class AllListsTable extends React.Component<{}, State> {
|
|||
: null} />
|
||||
<Table.Column<List> title="Details"
|
||||
dataIndex={nameof<List>("viewUrl")}
|
||||
width={123}
|
||||
className={styles.nogrow}
|
||||
fixed={this.state.isNarrowWindow ? undefined : "right"}
|
||||
render={(_text: string, record: List) => <ListDetails list={record} />} />
|
||||
|
|
|
|||
Loading…
Reference in a new issue