-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathvertical.tsx
More file actions
144 lines (135 loc) · 4.23 KB
/
vertical.tsx
File metadata and controls
144 lines (135 loc) · 4.23 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/* tslint:disable:no-console */
import 'rmc-tabs/assets/index.less';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { Tabs } from '../src';
class BasicDemo extends React.Component<{}, {
}> {
constructor(props: any) {
super(props);
}
renderContent() {
const pStyle = { margin: 0, padding: 10 } as React.CSSProperties;
return [
<div key="1" style={{ background: '#ADFFD7' }}>
<p style={pStyle}>tab 1 1</p>
<p style={pStyle}>tab 1 2</p>
<p style={pStyle}>tab 1 3</p>
<p style={pStyle}>tab 1 4</p>
</div>,
<div key="2" style={{ background: '#ADFFD7' }}>
<p style={pStyle}>tab 2 1</p>
<p style={pStyle}>tab 2 2</p>
<p style={pStyle}>tab 2 3</p>
<p style={pStyle}>tab 2 4</p>
<p style={pStyle}>tab 2 5</p>
<p style={pStyle}>tab 2 6</p>
<p style={pStyle}>tab 2 7</p>
<p style={pStyle}>tab 2 8</p>
<p style={pStyle}>tab 2 9</p>
</div>,
<div key="3" style={{ background: '#ADFFD7' }}>tab 3</div>,
<div key="4" style={{ background: '#ADFFD7' }}>tab 4</div>,
<div key="5" style={{ background: '#ADFFD7' }}>tab 5</div>,
<div key="6" style={{ background: '#ADFFD7' }}>tab 6</div>,
<div key="7" style={{ background: '#ADFFD7' }}>tab 7</div>,
<div key="8" style={{ background: '#ADFFD7' }}>tab 8</div>,
<div key="9" style={{ background: '#ADFFD7' }}>tab 9</div>,
];
}
render() {
const baseStyle = {
display: 'flex', flexDirection: 'column', marginTop: 10, marginBottom: 10, fontSize: 14
} as React.CSSProperties;
return (
<div>
<div style={baseStyle}>
<h2>vertical</h2>
<Tabs tabs={[
{ title: 't1' },
{ title: 't2' },
{ title: 't3' },
{ title: 't4' },
{ title: 't5' },
]} tabBarPosition="left"
>
{this.renderContent()}
</Tabs>
</div>
<div style={{ ...baseStyle, height: 200 }}>
<h2>vertical fixed height</h2>
<Tabs tabs={[
{ title: 't1' },
{ title: 't2' },
{ title: 't3' },
{ title: 't4' },
{ title: 't5' },
]} tabBarPosition="left" tabDirection="vertical"
>
{this.renderContent()}
</Tabs>
</div>
<div style={{ ...baseStyle, height: 200 }}>
<h2>vertical right</h2>
<Tabs tabs={[
{ title: 't1' },
{ title: 't2' },
{ title: 't3' },
{ title: 't4' },
{ title: 't5' },
]} tabBarPosition="right" tabDirection="vertical"
>
{this.renderContent()}
</Tabs>
</div>
<div style={{ ...baseStyle, height: 200 }}>
<h2>no paged</h2>
<Tabs tabs={[
{ title: 't1' },
{ title: 't2' },
{ title: 't3' },
{ title: 't4' },
{ title: 't5' },
]} tabBarPosition="right" tabDirection="vertical" usePaged={false}
>
{this.renderContent()}
</Tabs>
</div>
<div style={{ ...baseStyle, height: 200 }}>
<h2>vertical right</h2>
<Tabs tabs={[
{ title: 't1' },
{ title: 't2' },
{ title: 't3' },
{ title: 't4' },
{ title: 't5' },
{ title: 't6' },
{ title: 't7' },
{ title: 't8' },
]} tabBarPosition="left" tabDirection="vertical"
>
{this.renderContent()}
</Tabs>
</div>
<div style={{ ...baseStyle, height: 200 }}>
<h2>useLeftInsteadTransform</h2>
<Tabs tabs={[
{ title: 't1' },
{ title: 't2' },
{ title: 't3' },
{ title: 't4' },
{ title: 't5' },
{ title: 't6' },
{ title: 't7' },
{ title: 't8' },
]} tabBarPosition="left" tabDirection="vertical"
useLeftInsteadTransform={true}
>
{this.renderContent()}
</Tabs>
</div>
</div>
);
}
}
ReactDOM.render(<BasicDemo />, document.getElementById('__react-content'));