Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(components): refactor roundtab stories #14956

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 67 additions & 42 deletions components/src/molecules/RoundTab.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,55 +1,80 @@
import * as 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: {},
}
Loading