mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
flatten components, add list details drawer stub
This commit is contained in:
parent
f68b0e9211
commit
6c87ed1be9
24 changed files with 69 additions and 30 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import { Layout, Menu } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
import { AllListsTable } from './modules';
|
||||
import { AllListsTable } from './components';
|
||||
|
||||
const { Header, Content, Footer } = Layout;
|
||||
|
||||
|
|
|
|||
11
src/FilterLists.Web.V2/src/components/Description.tsx
Normal file
11
src/FilterLists.Web.V2/src/components/Description.tsx
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import React from 'react';
|
||||
|
||||
interface Props {
|
||||
description: string;
|
||||
descriptionSourceUrl: string;
|
||||
};
|
||||
|
||||
export const Description = (props: Props): JSX.Element =>
|
||||
props.description
|
||||
? <blockquote cite={props.description}>{props.description}</blockquote>
|
||||
: <p>{props.description}</p>;
|
||||
|
|
@ -1,12 +1,12 @@
|
|||
import { Table } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
import { Description, LanguageCloud, SubscribeButton, TagCloud } from '../../shared';
|
||||
import { Description, LanguageCloud, ListDetails, TagCloud } from '..';
|
||||
import { Language } from '../../interfaces/Language';
|
||||
import { List } from '../../interfaces/List';
|
||||
import { Tag } from '../../interfaces/Tag';
|
||||
import { nameof } from '../../utils';
|
||||
import styles from './AllListsTable.module.css';
|
||||
import { Language } from './Language';
|
||||
import { List } from './List';
|
||||
import { Tag } from './Tag';
|
||||
|
||||
interface State {
|
||||
lists: List[];
|
||||
|
|
@ -90,8 +90,7 @@ export class AllListsTable extends React.Component<{}, State> {
|
|||
title="Description"
|
||||
dataIndex={nameof<List>("description")}
|
||||
className={styles.nogrow}
|
||||
render={(text: string, record: List) =>
|
||||
<Description desriptionSourceUrl={record.descriptionSourceUrl} desription={text} />} />
|
||||
render={(_text: string, record: List) => <Description {...record} />} />
|
||||
<Table.Column<List>
|
||||
title="Software"
|
||||
dataIndex={nameof<List>("syntaxId")}
|
||||
|
|
@ -117,13 +116,12 @@ export class AllListsTable extends React.Component<{}, State> {
|
|||
tagIds
|
||||
? <TagCloud tags={this.state.tags.filter((t: Tag) => tagIds.includes(t.id))} />
|
||||
: null} />
|
||||
<Table.Column<List> title="Subscribe"
|
||||
<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, index: number) =>
|
||||
<SubscribeButton key={index} viewUrl={text} viewUrlMirrors={record.viewUrlMirrors} name={record.name} />} />
|
||||
render={(_text: string, record: List) => <ListDetails list={record} />} />
|
||||
</Table>
|
||||
);
|
||||
}
|
||||
8
src/FilterLists.Web.V2/src/components/index.ts
Normal file
8
src/FilterLists.Web.V2/src/components/index.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { AllListsTable } from './allListsTable';
|
||||
import { SubscribeButton } from './buttons';
|
||||
import { Description } from './Description';
|
||||
import { LanguageCloud } from './languageCloud';
|
||||
import { ListDetails } from './listDetails';
|
||||
import { TagCloud } from './tagCloud';
|
||||
|
||||
export { SubscribeButton, Description, LanguageCloud, TagCloud, AllListsTable, ListDetails };
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
import { Button, Drawer } from 'antd';
|
||||
import React from 'react';
|
||||
|
||||
import { Description } from '..';
|
||||
import { List } from '../../interfaces/List';
|
||||
|
||||
interface State {
|
||||
visible: boolean;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
list: List;
|
||||
};
|
||||
|
||||
export class ListDetails extends React.Component<Props, State> {
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
this.state = {
|
||||
visible: false
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<span>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => this.setState({ visible: true, })}>
|
||||
Details
|
||||
</Button>
|
||||
<Drawer
|
||||
visible={this.state.visible}
|
||||
onClose={() => this.setState({ visible: false, })}>
|
||||
<Description {...this.props.list} />
|
||||
</Drawer>
|
||||
</span>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import { ListDetails } from './ListDetails';
|
||||
|
||||
export { ListDetails };
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
import { AllListsTable } from './allListsTable';
|
||||
|
||||
export { AllListsTable }
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
import React from 'react';
|
||||
|
||||
interface Props {
|
||||
desription: string;
|
||||
desriptionSourceUrl: string;
|
||||
};
|
||||
|
||||
export const Description = (props: Props): JSX.Element =>
|
||||
props.desriptionSourceUrl
|
||||
? <blockquote cite={props.desriptionSourceUrl}>{props.desription}</blockquote>
|
||||
: <p>{props.desription}</p>;
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
import { SubscribeButton } from './buttons';
|
||||
import { Description } from './Description';
|
||||
import { LanguageCloud } from './languageCloud';
|
||||
import { TagCloud } from './tagCloud';
|
||||
|
||||
export { SubscribeButton, Description, LanguageCloud, TagCloud };
|
||||
Loading…
Reference in a new issue