From c471b8b3fb92ab98614f9501c414db888bc54c6c Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 26 Jul 2017 13:39:09 +0900 Subject: [PATCH] probe setup --- .../probe/react/components/ProbeDown.tsx | 117 ++++++++++++++++-- 1 file changed, 104 insertions(+), 13 deletions(-) diff --git a/src/ts/@overflow/probe/react/components/ProbeDown.tsx b/src/ts/@overflow/probe/react/components/ProbeDown.tsx index 1709549..e5db489 100644 --- a/src/ts/@overflow/probe/react/components/ProbeDown.tsx +++ b/src/ts/@overflow/probe/react/components/ProbeDown.tsx @@ -4,8 +4,8 @@ import { Menu, Segment, MenuItemProps, - Header, Container, + Icon, } from 'semantic-ui-react'; export interface StateProps { @@ -19,45 +19,81 @@ export interface DispatchProps { export type Props = StateProps & DispatchProps; export interface State { - activeItem: string[]; + activeItem: string; } -const osNames = ['Windows', 'Debian', 'Ubuntu', 'Fedora', 'CentOS']; +const osNames = [ + { + 'name': 'Windows', + 'icon': 'windows', + }, + { + 'name': 'Ubuntu', + 'icon': 'linux', + }, + { + 'name': 'Fedora', + 'icon': 'linux', + }, + { + 'name': 'CentOS', + 'icon': 'linux', + }, +]; export class ProbeDown extends React.Component { constructor(props: Props, context: State) { super(props, context); - this.state = { activeItem: osNames[0] }; + this.state = { activeItem: osNames[0].name }; } public handleItemClick = (event: React.SyntheticEvent, data: MenuItemProps): void => { this.setState({ activeItem: data.name }); + } - console.log(data.name); + public ShowContent = (): JSX.Element => { + let os = this.state.activeItem; + switch (os) { + case 'Windows': { + return ; + } + case 'Ubuntu': { + return ; + } + case 'Fedora': { + return ; + } + case 'CentOS': { + return ; + } + default: + break; + } + return null; } public render(): JSX.Element { - const { activeItem } = this.state.activeItem; return ( -
Probe Download
- - {osNames.map((os: string) => { + + {osNames.map((item: any, index: number) => { return ( - + + + {item.name} + ); })} - - - {this.state.activeItem} Download Page + + {this.ShowContent()} @@ -66,3 +102,58 @@ export class ProbeDown extends React.Component { } } +export class Windows extends React.Component { + constructor(props: Props, context: State) { + super(props, context); + } + + public render(): JSX.Element { + return ( +
+ Windows Download Page +
+ ); + } +} + +export class Ubuntu extends React.Component { + constructor(props: Props, context: State) { + super(props, context); + } + + public render(): JSX.Element { + return ( + + Ubuntu Download Page + + ); + } +} + +export class Fedora extends React.Component { + constructor(props: Props, context: State) { + super(props, context); + } + + public render(): JSX.Element { + return ( + + Fedora Download Page + + ); + } +} + +export class CentOS extends React.Component { + constructor(props: Props, context: State) { + super(props, context); + } + + public render(): JSX.Element { + return ( + + CentOS Download Page + + ); + } +}