-
-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
806 additions
and
359 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ export default defineConfig({ | |
name: 'Tabs', | ||
}, | ||
mfsu: false, | ||
}); | ||
}); |
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 |
---|---|---|
|
@@ -31,6 +31,7 @@ es | |
coverage | ||
yarn.lock | ||
package-lock.json | ||
pnpm-lock.yaml | ||
|
||
# umi | ||
.umi | ||
|
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,8 @@ | ||
--- | ||
title: dynamic-extra | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../examples/dynamic-extra.tsx"></code> |
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,8 @@ | ||
--- | ||
title: Indicator | ||
nav: | ||
title: Demo | ||
path: /demo | ||
--- | ||
|
||
<code src="../examples/indicator.tsx"></code> |
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,38 @@ | ||
import React from 'react'; | ||
import Tabs from '../../src'; | ||
import type { TabsProps } from '../../src'; | ||
import '../../assets/index.less'; | ||
|
||
const items: TabsProps['items'] = []; | ||
for (let i = 0; i < 50; i += 1) { | ||
items.push({ | ||
key: String(i), | ||
label: `Tab ${i}`, | ||
children: `Content of ${i}`, | ||
}); | ||
} | ||
export default () => { | ||
const [key, setKey] = React.useState('0'); | ||
|
||
const extra = React.useMemo(() => { | ||
if (key === '0') { | ||
return ( | ||
<div>额外内容</div> | ||
) | ||
} | ||
return null | ||
}, [key]) | ||
|
||
return ( | ||
<div style={{ maxWidth: 550 }}> | ||
<Tabs | ||
activeKey={key} | ||
onChange={(curKey) => setKey(curKey)} | ||
tabBarExtraContent={extra} | ||
defaultActiveKey="8" | ||
moreIcon="..." | ||
items={items} | ||
/> | ||
</div> | ||
); | ||
}; |
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,63 @@ | ||
import React from 'react'; | ||
import '../../assets/index.less'; | ||
import type { TabsProps } from '../../src'; | ||
import Tabs from '../../src'; | ||
|
||
const items: TabsProps['items'] = [ | ||
{ | ||
label: 'Light', | ||
key: 'light', | ||
children: 'Light!', | ||
}, | ||
{ | ||
label: 'Bamboo', | ||
key: 'bamboo', | ||
children: 'Bamboo!', | ||
}, | ||
{ | ||
label: 'Cute', | ||
key: 'cute', | ||
children: 'Cute!', | ||
}, | ||
]; | ||
|
||
export default () => ( | ||
<> | ||
<Tabs | ||
tabPosition="top" | ||
items={items} | ||
indicatorSize={origin => origin - 20} | ||
indicatorAlign="start" | ||
/> | ||
<Tabs | ||
tabPosition="top" | ||
items={items} | ||
indicatorSize={origin => origin - 20} | ||
indicatorAlign="center" | ||
/> | ||
<Tabs | ||
tabPosition="top" | ||
items={items} | ||
indicatorSize={origin => origin - 20} | ||
indicatorAlign="end" | ||
/> | ||
<Tabs | ||
tabPosition="left" | ||
items={items} | ||
indicatorSize={origin => origin - 20} | ||
indicatorAlign="start" | ||
/> | ||
<Tabs | ||
tabPosition="left" | ||
items={items} | ||
indicatorSize={origin => origin - 20} | ||
indicatorAlign="center" | ||
/> | ||
<Tabs | ||
tabPosition="left" | ||
items={items} | ||
indicatorSize={origin => origin - 20} | ||
indicatorAlign="end" | ||
/> | ||
</> | ||
); |
Oops, something went wrong.