-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.jsx
104 lines (97 loc) · 3.92 KB
/
index.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import 'trendmicro-ui/dist/css/trendmicro-ui.css';
import '@trendmicro/react-buttons/dist/react-buttons.css';
import '@trendmicro/react-sidenav/dist/react-sidenav.css';
import Iframe from '@trendmicro/react-iframe';
import SideNav, { NavItem, NavIcon, NavText } from '@trendmicro/react-sidenav';
import React, { PureComponent } from 'react';
import ReactDOM from 'react-dom';
import styled from 'styled-components';
import components from './components.png';
const Main = styled.main`
margin-left: ${props => (props.expanded ? 240 : 64)}px;
height: 100vh;
overflow-y: hidden;
`;
class App extends PureComponent {
timer = null;
state = {
expanded: true,
componentName: 'react-grid-system'
};
components = [
{ name: 'react-grid-system', label: 'Grid System' },
{ name: 'react-anchor', label: 'Anchor' },
{ name: 'react-breadcrumbs', label: 'Breadcrumbs' },
{ name: 'react-buttons', label: 'Buttons' },
{ name: 'react-checkbox', label: 'Checkbox' },
{ name: 'react-datepicker', label: 'Datepicker' },
{ name: 'react-dropdown', label: 'Dropdown' },
{ name: 'react-iframe', label: 'Iframe' },
{ name: 'react-interpolate', label: 'Interpolate' },
{ name: 'react-liquid-gauge', label: 'Liquid Gauge' },
{ name: 'react-loader', label: 'Loader' },
{ name: 'react-modal', label: 'Modal' },
{ name: 'react-navbar', label: 'Navbar' },
{ name: 'react-navs', label: 'Navs' },
{ name: 'react-notifications', label: 'Notifications' },
{ name: 'react-paginations', label: 'Paginations' },
{ name: 'react-popover', label: 'Popover' },
{ name: 'react-portal', label: 'Portal' },
{ name: 'react-radio', label: 'Radio' },
{ name: 'react-sidenav', label: 'Side Navigation' },
{ name: 'react-table', label: 'Table' },
{ name: 'react-toggle-switch', label: 'Toggle Switch' },
{ name: 'react-tooltip', label: 'Tooltip' },
{ name: 'react-validation', label: 'Validation' }
];
render() {
const { expanded } = this.state;
return (
<div>
<SideNav
expanded={expanded}
onToggle={expanded => {
this.setState({ expanded: expanded });
}}
onSelect={selected => {
this.setState({ componentName: selected });
}}
>
<SideNav.Toggle />
<SideNav.Nav>
<NavItem
eventKey="react-component"
expanded
>
<NavIcon>
<img src={components} alt="" style={{ marginRight: 4 }} />
</NavIcon>
<NavText>
React Components
</NavText>
{this.components.map(component => (
<NavItem
key={component.name}
eventKey={component.name}
active={this.state.componentName === component.name}
>
<NavText>{component.label}</NavText>
</NavItem>
))}
</NavItem>
</SideNav.Nav>
</SideNav>
<Main expanded={expanded}>
<Iframe
height="100%"
src={`https://trendmicro-frontend.github.io/${this.state.componentName}/`}
/>
</Main>
</div>
);
}
}
ReactDOM.render(
<App />,
document.getElementById('container')
);