mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
This effectively covers the `Tab` component as well, which doesn't really make sense to showcase on its own. One minor change was made to the actual `Tabs` component; `children` was marked as a required prop. It doesn't render anything sensible if they are omitted, and it always has at least one child in our codebase.
58 lines
1.0 KiB
JavaScript
58 lines
1.0 KiB
JavaScript
import React from 'react'
|
|
import Tab from './tab/tab.component'
|
|
import Tabs from './tabs.component'
|
|
import { number, text } from '@storybook/addon-knobs/react'
|
|
|
|
export default {
|
|
title: 'Tabs',
|
|
}
|
|
|
|
function renderTab (id) {
|
|
return (
|
|
<Tab
|
|
name={text(`Tab ${id} Name`, `Tab ${id}`)}
|
|
key={id}
|
|
>
|
|
{text(`Tab ${id} Contents`, `Contents of Tab ${id}`)}
|
|
</Tab>
|
|
)
|
|
}
|
|
|
|
export const twoTabs = () => {
|
|
return (
|
|
<Tabs
|
|
defaultActiveTabIndex={number('Default Active Tab Index', 0, { min: 0 })}
|
|
>
|
|
{
|
|
['A', 'B']
|
|
.map(renderTab)
|
|
}
|
|
</Tabs>
|
|
)
|
|
}
|
|
|
|
export const manyTabs = () => {
|
|
return (
|
|
<Tabs
|
|
defaultActiveTabIndex={number('Default Active Tab Index', 0, { min: 0 })}
|
|
>
|
|
{
|
|
['A', 'B', 'C', 'D', 'E']
|
|
.map(renderTab)
|
|
}
|
|
</Tabs>
|
|
)
|
|
}
|
|
|
|
export const singleTab = () => {
|
|
return (
|
|
<Tabs>
|
|
<Tab
|
|
name={text('Name', 'Single A')}
|
|
>
|
|
{text('Contents', 'Contents of tab')}
|
|
</Tab>
|
|
</Tabs>
|
|
)
|
|
}
|