-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(components): refactor roundtab stories
update roundtab stories to align with the actual app design close AUTH-
- Loading branch information
Showing
1 changed file
with
68 additions
and
43 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 |
---|---|---|
@@ -1,55 +1,80 @@ | ||
import * as React from 'react' | ||
import React from 'react' | ||
import { SPACING, TYPOGRAPHY } from '../ui-style-constants' | ||
import { Flex, Text } from '../primitives' | ||
import { DIRECTION_ROW } from '../styles' | ||
import { RoundTab } from './RoundTab' | ||
import type { Story, Meta } from '@storybook/react' | ||
import { Flex } from '../primitives' | ||
import { StyledText } from '../atoms/StyledText' | ||
import { DIRECTION_COLUMN, DIRECTION_ROW } from '../styles' | ||
import { RoundTab as RoundTabComponent } from './RoundTab' | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
export default { | ||
const meta: Meta<typeof RoundTabComponent> = { | ||
title: 'Library/Molecules/RoundTab', | ||
component: RoundTab, | ||
} as Meta | ||
|
||
const Template: Story< | ||
React.ComponentProps<typeof RoundTab> | ||
> = (): JSX.Element => { | ||
const [step, setStep] = React.useState<'details' | 'pipette' | 'module'>( | ||
'details' | ||
) | ||
component: RoundTabComponent, | ||
decorators: [Story => <Tabs />], | ||
} | ||
export default meta | ||
|
||
const Tabs = (): JSX.Element => { | ||
const [step, setStep] = React.useState< | ||
'setup' | 'parameters' | 'module controls' | 'run preview' | ||
>('setup') | ||
|
||
return ( | ||
<Flex | ||
width="100%" | ||
height="100%" | ||
flexDirection={DIRECTION_ROW} | ||
marginLeft={SPACING.spacing16} | ||
flexDirection={DIRECTION_COLUMN} | ||
gridGap={SPACING.spacing16} | ||
padding={SPACING.spacing16} | ||
> | ||
<RoundTab | ||
isCurrent={step === 'details'} | ||
onClick={() => setStep('details')} | ||
> | ||
<Text textTransform={TYPOGRAPHY.textTransformCapitalize}> | ||
{'Protocol Name and Description'} | ||
</Text> | ||
</RoundTab> | ||
|
||
<RoundTab | ||
isCurrent={step === 'pipette'} | ||
onClick={() => setStep('pipette')} | ||
<Flex flexDirection={DIRECTION_ROW} gridGap={SPACING.spacing4}> | ||
<RoundTabComponent | ||
isCurrent={step === 'setup'} | ||
onClick={() => setStep('setup')} | ||
tabName={'setup'} | ||
> | ||
<StyledText textTransform={TYPOGRAPHY.textTransformCapitalize}> | ||
{'Setup'} | ||
</StyledText> | ||
</RoundTabComponent> | ||
|
||
<RoundTabComponent | ||
isCurrent={step === 'parameters'} | ||
onClick={() => setStep('parameters')} | ||
> | ||
<StyledText textTransform={TYPOGRAPHY.textTransformCapitalize}> | ||
{'Parameters'} | ||
</StyledText> | ||
</RoundTabComponent> | ||
|
||
<RoundTabComponent | ||
isCurrent={step === 'module controls'} | ||
onClick={() => setStep('module controls')} | ||
> | ||
<StyledText textTransform={TYPOGRAPHY.textTransformCapitalize}> | ||
{'Module Controls'} | ||
</StyledText> | ||
</RoundTabComponent> | ||
|
||
<RoundTabComponent | ||
isCurrent={step === 'run preview'} | ||
onClick={() => setStep('run preview')} | ||
> | ||
<StyledText textTransform={TYPOGRAPHY.textTransformCapitalize}> | ||
{'Run Preview'} | ||
</StyledText> | ||
</RoundTabComponent> | ||
</Flex> | ||
<StyledText | ||
as="h3" | ||
fontWeight={TYPOGRAPHY.fontWeightSemiBold} | ||
textTransform={TYPOGRAPHY.textTransformCapitalize} | ||
> | ||
<Text textTransform={TYPOGRAPHY.textTransformCapitalize}> | ||
{'Pipette Selection'} | ||
</Text> | ||
</RoundTab> | ||
|
||
<RoundTab isCurrent={step === 'module'} onClick={() => setStep('module')}> | ||
<Text textTransform={TYPOGRAPHY.textTransformCapitalize}> | ||
{'Module Selection'} | ||
</Text> | ||
</RoundTab> | ||
{step} | ||
</StyledText> | ||
</Flex> | ||
) | ||
} | ||
|
||
export const Basic = Template.bind({}) | ||
Basic.args = {} | ||
type Story = StoryObj<typeof RoundTabComponent> | ||
|
||
export const RoundTab: Story = { | ||
args: {}, | ||
} |