From 4f682fe79c53e98664e22655ba33cafebf87b641 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 12 Jul 2017 18:40:55 +0900 Subject: [PATCH] tab --- src/ts/containers/test/Components.tsx | 25 ++++++----------- src/ts/containers/test/Probes.tsx | 18 ++++++------ src/ts/containers/test/commons/Tab.tsx | 38 ++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 25 deletions(-) create mode 100644 src/ts/containers/test/commons/Tab.tsx diff --git a/src/ts/containers/test/Components.tsx b/src/ts/containers/test/Components.tsx index da1d183..5a63c64 100644 --- a/src/ts/containers/test/Components.tsx +++ b/src/ts/containers/test/Components.tsx @@ -1,42 +1,33 @@ import * as React from 'react'; -import { Button } from 'semantic-ui-react'; import { Probes } from './Probes'; import { NoauthProbes } from './NoauthProbes'; import { SensorConfiguration } from './SensorConfiguration'; import { Targets } from './Targets'; +import { Tab } from './commons/Tab'; -import Tab, { TabProps } from 'semantic-ui-react/dist/commonjs/modules/Tab'; - +// import Tab, { TabProps } from 'semantic-ui-react/dist/commonjs/modules/Tab'; export class Components extends React.Component { constructor(props: any, context: any) { super(props, context); this.state = { - no: 0, }; } - handleButton(n: number): void { - this.setState({ - no: n, - }); - } - render() { - const panes = [ - { menuItem: 'Probes', render: () => }, - { menuItem: 'Noauth Probes', render: () => }, - { menuItem: 'Sensor Configuration', render: () => }, - { menuItem: 'Targets', render: () => }, + const items = [ + { name: 'Probes', child: }, + { name: 'NoauthProbes', child: }, + { name: 'SensorConfiguration', child: }, + { name: 'Targets', child: }, ]; return ( - + ); } } - diff --git a/src/ts/containers/test/Probes.tsx b/src/ts/containers/test/Probes.tsx index 97a4961..f1a84f1 100644 --- a/src/ts/containers/test/Probes.tsx +++ b/src/ts/containers/test/Probes.tsx @@ -80,23 +80,25 @@ export class Probes extends React.Component { return (
- +
- No. + Name + CIDR Status - Probe Key - Description + Target Count + Sensor Count {this.data.map((probe: any, index: number) => ( - {index + 1} - {probe.metaProbeStatus.name} - {probe.probeKey} - {probe.description} + todo. {probe.name} + todo. {probe.cidr} + {probe.metaProbeStatus.name} + todo. {probe.targetCnt} + todo. {probe.sensorCnt} ))} diff --git a/src/ts/containers/test/commons/Tab.tsx b/src/ts/containers/test/commons/Tab.tsx new file mode 100644 index 0000000..8ba0263 --- /dev/null +++ b/src/ts/containers/test/commons/Tab.tsx @@ -0,0 +1,38 @@ +import * as React from 'react'; +import { Menu, Segment } from 'semantic-ui-react'; + +export class Tab extends React.Component { + + constructor(props: any, context: any) { + super(props, context); + this.state = { + active: 0, + }; + } + + showContents() { + return this.props.panes[this.state.active].child; + } + + handleClick(index: number) { + this.setState({ + active: index, + }); + } + + render() { + return ( +
+ + {this.props.panes.map((pane: any, index: number) => ( + + ))} + + + + {this.showContents()} + +
+ ); + } +} \ No newline at end of file