Skip to content

Commit 78c25f9

Browse files
committed
feat: add draft tabs stories
1 parent 656ec89 commit 78c25f9

File tree

2 files changed

+57
-16
lines changed

2 files changed

+57
-16
lines changed

src/style/theme.scss

+10-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
@import 'mo/components/menu/style';
2222
@import 'mo/components/toolbar/style';
2323
@import 'mo/components/tree/style';
24+
@import 'mo/components/tabs/style';
2425

2526
// =============== Workbench =============== //
2627
#{prefix($workbench)} {
@@ -118,6 +119,7 @@
118119
@mixin border-color($color) {
119120
border: 1px solid $color;
120121
}
122+
121123
#{prefix($collapse)} {
122124
background-color: #252526;
123125

@@ -149,21 +151,26 @@
149151
}
150152
}
151153

152-
.rc-tree-treenode.drag-over > .draggable {
154+
.rc-tree-treenode.drag-over>.draggable {
153155
@include border-color(#316ac5);
154156
background-color: #316ac5;
155157
color: #bbb;
156158
}
157159

158-
.rc-tree-treenode.drag-over-gap-top > .draggable {
160+
.rc-tree-treenode.drag-over-gap-top>.draggable {
159161
border-top: 2px rgb(0, 122, 204) solid;
160162
}
161163

162-
.rc-tree-treenode.drag-over-gap-bottom > .draggable {
164+
.rc-tree-treenode.drag-over-gap-bottom>.draggable {
163165
border-bottom: 2px rgb(0, 122, 204) solid;
164166
}
165167

166168
.rc-tree-treenode-active {
167169
background: rgba(0, 0, 0, 0.1);
168170
}
169171
}
172+
173+
// =============== Tab =============== //
174+
#{prefix($tabSwitcher)} {
175+
background-color: rgb(37, 37, 38);
176+
}

stories/components/3-Tabs.stories.tsx

+47-13
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,49 @@
11
import * as React from 'react';
2+
import { useState } from 'react';
3+
import Tabs from 'mo/components/tabs';
4+
import { storiesOf } from '@storybook/react';
5+
import { withKnobs } from '@storybook/addon-knobs';
6+
const stories = storiesOf('Tab', module);
7+
stories.addDecorator(withKnobs);
28

3-
import Tabs, { ITab } from 'mo/components/tabs';
4-
5-
export default {
6-
title: 'Tabs',
7-
};
8-
9-
const data: ITab[] = [
10-
{
11-
id: 1,
12-
name: 'test',
13-
},
14-
];
15-
export const Basic = () => <Tabs data={data} />;
9+
stories.add('Basic Usage', () => {
10+
const onMoveTab = (tabs) => setTabs(tabs);
11+
const data = [
12+
{
13+
modified: true,
14+
id: 1,
15+
name: 'editor.js',
16+
value: 'hello javascript',
17+
},
18+
{
19+
activeTab: 1,
20+
modified: false,
21+
id: 2,
22+
name: 'editor.css',
23+
value: 'hello css',
24+
},
25+
{
26+
modified: false,
27+
id: 3,
28+
name: 'editor.tsx',
29+
value: 'hello tsx',
30+
},
31+
];
32+
const [tabs, setTabs] = useState(data);
33+
return (
34+
<div>
35+
<h2>简述</h2>
36+
<p>Tab 提供组件多tab切换;拖拽</p>
37+
<div>
38+
<h3>使用示例 1 - 基本使用</h3>
39+
<div style={{ height: 200 }}>
40+
<Tabs
41+
data={tabs}
42+
onMoveTab={onMoveTab}
43+
onTabChange={(data) => console.log(data)}
44+
/>
45+
</div>
46+
</div>
47+
</div>
48+
);
49+
});

0 commit comments

Comments
 (0)