-
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: useTabs * chore: add useTabs * chore: tabs mini * chore: tabs scrollable * chore: tabpanel * fix: tabs * chore: 优化tabs mini * chore: tabs demo * chore: tabs demo * chore: tabs add value * perf: tabs --------- Co-authored-by: Yang <[email protected]>
- Loading branch information
Showing
35 changed files
with
930 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { useState } from 'react'; | ||
import { Panel, Tabs } from 'zarm/mini'; | ||
|
||
const Demo = () => { | ||
const [value, setValue] = useState(0); | ||
|
||
return ( | ||
<Panel title="基本用法"> | ||
<Tabs value={value} onChange={setValue}> | ||
<Tabs.Panel title="选项卡1"> | ||
<div className="content">选项卡1内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡2"> | ||
<div className="content">选项卡2内容</div> | ||
</Tabs.Panel> | ||
</Tabs> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, { useState } from 'react'; | ||
import { Panel, Tabs } from 'zarm/mini'; | ||
|
||
const Demo = () => { | ||
const [value, setValue] = useState(0); | ||
|
||
return ( | ||
<Panel title="禁用指定选项"> | ||
<Tabs value={value} onChange={setValue}> | ||
<Tabs.Panel title="选项卡1"> | ||
<div className="content">选项卡1内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡2" disabled> | ||
<div className="content">选项卡2内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡3"> | ||
<div className="content">选项卡3内容</div> | ||
</Tabs.Panel> | ||
</Tabs> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default Demo; |
24 changes: 24 additions & 0 deletions
24
packages/mini-demo/src/pages/tabs/component/line-width.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React, { useState } from 'react'; | ||
import { Panel, Tabs } from 'zarm/mini'; | ||
|
||
const Demo = () => { | ||
const [value, setValue] = useState(0); | ||
|
||
return ( | ||
<Panel title="指定线条宽度"> | ||
<Tabs value={value} onChange={setValue} lineWidth="60px"> | ||
<Tabs.Panel title="选项卡1"> | ||
<div className="content">选项卡1内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡2"> | ||
<div className="content">选项卡2内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡3"> | ||
<div className="content">选项卡3内容</div> | ||
</Tabs.Panel> | ||
</Tabs> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default Demo; |
33 changes: 33 additions & 0 deletions
33
packages/mini-demo/src/pages/tabs/component/scrollable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useState } from 'react'; | ||
import { Panel, Tabs } from 'zarm/mini'; | ||
|
||
const Demo = () => { | ||
const [value, setValue] = useState(0); | ||
|
||
return ( | ||
<Panel title="标签栏滚动"> | ||
<Tabs value={value} onChange={setValue} scrollable> | ||
<Tabs.Panel title="选项卡1"> | ||
<div className="content">选项卡1内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡2"> | ||
<div className="content">选项卡2内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡3"> | ||
<div className="content">选项卡3内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡4"> | ||
<div className="content">选项卡1内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡5"> | ||
<div className="content">选项卡2内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡6"> | ||
<div className="content">选项卡3内容</div> | ||
</Tabs.Panel> | ||
</Tabs> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { useState } from 'react'; | ||
import { Panel, Tabs } from 'zarm/mini'; | ||
|
||
const Demo = () => { | ||
const [value, setValue] = useState(0); | ||
|
||
return ( | ||
<Panel title="可滑动"> | ||
<Tabs value={value} onChange={setValue} swipeable> | ||
<Tabs.Panel title="选项卡1"> | ||
<div className="content">选项卡1内容</div> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡2"> | ||
<div className="content">选项卡2内容</div> | ||
</Tabs.Panel> | ||
</Tabs> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default Demo; |
43 changes: 43 additions & 0 deletions
43
packages/mini-demo/src/pages/tabs/component/vertical-scrollable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { View } from '@tarojs/components'; | ||
import React, { useState } from 'react'; | ||
import { Panel, Tabs } from 'zarm/mini'; | ||
|
||
const Demo = () => { | ||
const [value, setValue] = useState(0); | ||
|
||
return ( | ||
<Panel title="垂直限制高度"> | ||
<Tabs | ||
value={value} | ||
onChange={setValue} | ||
direction="vertical" | ||
scrollable | ||
className="custom-height" | ||
> | ||
<Tabs.Panel title="选项卡1"> | ||
<View className="vertical-content">选项卡1内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡2"> | ||
<View className="vertical-content">选项卡2内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡3"> | ||
<View className="vertical-content">选项卡3内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡4"> | ||
<View className="vertical-content">选项卡4内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡5"> | ||
<View className="vertical-content">选项卡5内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡6"> | ||
<View className="vertical-content">选项卡6内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡7"> | ||
<View className="vertical-content">选项卡7内容</View> | ||
</Tabs.Panel> | ||
</Tabs> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { View } from '@tarojs/components'; | ||
import React, { useState } from 'react'; | ||
import { Panel, Tabs } from 'zarm/mini'; | ||
|
||
const Demo = () => { | ||
const [value, setValue] = useState(0); | ||
|
||
return ( | ||
<Panel title="垂直"> | ||
<Tabs value={value} onChange={setValue} direction="vertical"> | ||
<Tabs.Panel title="选项卡1"> | ||
<View className="vertical-content">选项卡1内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡2"> | ||
<View className="vertical-content">选项卡2内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡3"> | ||
<View className="vertical-content">选项卡3内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡4"> | ||
<View className="vertical-content">选项卡4内容</View> | ||
</Tabs.Panel> | ||
<Tabs.Panel title="选项卡5"> | ||
<View className="vertical-content">选项卡5内容</View> | ||
</Tabs.Panel> | ||
</Tabs> | ||
</Panel> | ||
); | ||
}; | ||
|
||
export default Demo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default definePageConfig({ | ||
navigationBarTitleText: 'Tabs', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.content { | ||
min-height: 300px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.custom-height { | ||
.za-tabs__tablist { | ||
height: 400px; | ||
} | ||
} | ||
|
||
.vertical-content { | ||
height: 100%; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import * as React from 'react'; | ||
import Basic from './component/basic'; | ||
import Disable from './component/disable'; | ||
import LineWidth from './component/line-width'; | ||
import Scrollable from './component/scrollable'; | ||
import Swipeable from './component/swipeable'; | ||
import Vertical from './component/vertical'; | ||
import VerticalScrollable from './component/vertical-scrollable'; | ||
import './index.scss'; | ||
|
||
export default () => { | ||
return ( | ||
<> | ||
<Basic /> | ||
<Disable /> | ||
<LineWidth /> | ||
<Scrollable /> | ||
<Swipeable /> | ||
<VerticalScrollable /> | ||
<Vertical /> | ||
</> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.