2022-03-08 22:50:35 +01:00
|
|
|
import React, { useState } from 'react';
|
2023-02-11 02:33:11 +01:00
|
|
|
import { Icon, ICON_NAMES } from '../../component-library';
|
2022-03-08 22:50:35 +01:00
|
|
|
import TabBar from '.';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Components/App/TabBar',
|
2023-01-20 20:27:46 +01:00
|
|
|
|
2022-03-08 22:50:35 +01:00
|
|
|
argTypes: {
|
|
|
|
isActive: {
|
|
|
|
action: 'isActive',
|
|
|
|
},
|
|
|
|
tabs: {
|
|
|
|
control: 'array',
|
|
|
|
},
|
|
|
|
onSelect: {
|
|
|
|
action: 'onSelect',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
args: {
|
|
|
|
tabs: [
|
|
|
|
{
|
2023-02-27 03:42:03 +01:00
|
|
|
icon: <Icon name={ICON_NAMES.SETTING} />,
|
2022-03-08 22:50:35 +01:00
|
|
|
content: 'General',
|
|
|
|
key: 'general',
|
|
|
|
},
|
|
|
|
{
|
2023-02-16 14:26:00 +01:00
|
|
|
icon: <Icon name={ICON_NAMES.BOOK} />,
|
2022-03-08 22:50:35 +01:00
|
|
|
content: 'Contacts',
|
|
|
|
key: 'contacts',
|
|
|
|
},
|
|
|
|
{
|
2022-03-21 14:58:36 +01:00
|
|
|
icon: <i className="fa fa-flask" />,
|
2022-03-08 22:50:35 +01:00
|
|
|
content: 'Snaps',
|
|
|
|
key: 'snaps',
|
|
|
|
},
|
|
|
|
{
|
2022-03-21 14:58:36 +01:00
|
|
|
icon: <i className="fa fa-lock" />,
|
2022-03-08 22:50:35 +01:00
|
|
|
content: 'SecurityAndPrivacy',
|
|
|
|
key: 'securityAndPrivacy',
|
|
|
|
},
|
|
|
|
{
|
2023-02-11 02:33:11 +01:00
|
|
|
icon: <Icon name={ICON_NAMES.NOTIFICATION} />,
|
2022-03-08 22:50:35 +01:00
|
|
|
content: 'Alerts',
|
|
|
|
key: 'alerts',
|
|
|
|
},
|
|
|
|
{
|
2022-03-21 14:58:36 +01:00
|
|
|
icon: <i className="fa fa-plug" />,
|
2022-03-08 22:50:35 +01:00
|
|
|
content: 'Networks',
|
|
|
|
key: 'networks',
|
|
|
|
},
|
|
|
|
{
|
2022-03-21 14:58:36 +01:00
|
|
|
icon: <i className="fa fa-flask" />,
|
2022-03-08 22:50:35 +01:00
|
|
|
content: 'Experimental',
|
|
|
|
key: 'experimental',
|
|
|
|
},
|
|
|
|
{
|
2022-03-21 14:58:36 +01:00
|
|
|
icon: <i className="fa fa-info-circle" />,
|
2022-03-08 22:50:35 +01:00
|
|
|
content: 'About',
|
|
|
|
key: 'about',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const DefaultStory = (args) => {
|
|
|
|
const [currentTab, setCurrentTab] = useState('');
|
|
|
|
const handleOnSelect = (key) => setCurrentTab(key);
|
|
|
|
const handleIsActive = (key) => currentTab === key;
|
|
|
|
return (
|
|
|
|
<TabBar
|
|
|
|
tabs={args.tabs}
|
|
|
|
isActive={handleIsActive}
|
|
|
|
onSelect={handleOnSelect}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
DefaultStory.storyName = 'Default';
|