-
-
Notifications
You must be signed in to change notification settings - Fork 9
chore: Added HeaderBase to DSR and DSRN #908
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
Changes from all commits
3af749d
c0ec125
498c5df
1233a95
749a4f3
118d77a
17ea8ba
09f6c78
8666f1d
dfab7e7
a957f35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // External dependencies. | ||
| import { TextVariant } from '../Text'; | ||
|
|
||
| /** | ||
| * Text variant used for the header title when children is a string. | ||
| */ | ||
| export const HEADERBASE_TITLE_TEXT_VARIANT = TextVariant.HeadingSm; | ||
|
|
||
| /** | ||
| * Default test IDs for HeaderBase component. | ||
| */ | ||
| export const HEADERBASE_TEST_ID = 'header'; | ||
| export const HEADERBASE_TITLE_TEST_ID = 'header-title'; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react-native'; | ||
| import React from 'react'; | ||
|
|
||
| import { Box } from '../Box'; | ||
| import { ButtonIcon, ButtonIconSize } from '../ButtonIcon'; | ||
| import { IconName } from '../Icon'; | ||
| import { Text, TextVariant } from '../Text'; | ||
|
|
||
| import HeaderBase from './HeaderBase'; | ||
| import type { HeaderBaseProps } from './HeaderBase.types'; | ||
|
|
||
| const meta: Meta<HeaderBaseProps> = { | ||
| title: 'Components/HeaderBase', | ||
| component: HeaderBase, | ||
| argTypes: { | ||
| children: { | ||
| control: 'text', | ||
| }, | ||
| twClassName: { | ||
| control: 'text', | ||
| }, | ||
| includesTopInset: { | ||
| control: 'boolean', | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
|
||
| type Story = StoryObj<HeaderBaseProps>; | ||
|
|
||
| const noop = (): void => undefined; | ||
|
|
||
| export const Default: Story = { | ||
| args: { | ||
| children: 'Header Title', | ||
| }, | ||
| render: (args) => <HeaderBase {...args} />, | ||
| }; | ||
|
|
||
| export const TwClassName: Story = { | ||
| render: () => ( | ||
| <HeaderBase twClassName="bg-info-default px-4"> | ||
| Header with Custom Styles | ||
| </HeaderBase> | ||
| ), | ||
| }; | ||
|
Comment on lines
+41
to
+47
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think we need this story for the twClassName prop just let the readme template explain it. If this was created by the cursor rule, let's update the rule to exclude these props that are taken care of by readme |
||
|
|
||
| export const StartButtonIconProps: Story = { | ||
| render: () => ( | ||
| <HeaderBase | ||
| startButtonIconProps={{ | ||
| iconName: IconName.ArrowLeft, | ||
| onPress: noop, | ||
| }} | ||
| > | ||
| With Start Button | ||
| </HeaderBase> | ||
| ), | ||
| }; | ||
|
|
||
| export const EndButtonIconProps: Story = { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe we can be a bit more selective on stories and improve the cursor rule here to exclude prop object, twClassName and style props |
||
| render: () => ( | ||
| <HeaderBase | ||
| endButtonIconProps={[ | ||
| { | ||
| iconName: IconName.Close, | ||
| onPress: noop, | ||
| }, | ||
| ]} | ||
| > | ||
| With End Button | ||
| </HeaderBase> | ||
| ), | ||
| }; | ||
|
|
||
| export const MultipleEndButtonIconProps: Story = { | ||
| render: () => ( | ||
| <HeaderBase | ||
| endButtonIconProps={[ | ||
| { | ||
| iconName: IconName.Close, | ||
| onPress: noop, | ||
| }, | ||
| { | ||
| iconName: IconName.Search, | ||
| onPress: noop, | ||
| }, | ||
| { | ||
| iconName: IconName.Setting, | ||
| onPress: noop, | ||
| }, | ||
| ]} | ||
| > | ||
| Multiple End Buttons | ||
| </HeaderBase> | ||
| ), | ||
| }; | ||
|
|
||
| export const StartAccessory: Story = { | ||
| render: () => ( | ||
| <HeaderBase | ||
| startAccessory={ | ||
| <ButtonIcon | ||
| iconName={IconName.ArrowLeft} | ||
| size={ButtonIconSize.Md} | ||
| onPress={noop} | ||
| /> | ||
| } | ||
| > | ||
| With Start Accessory | ||
| </HeaderBase> | ||
| ), | ||
| }; | ||
|
|
||
| export const EndAccessory: Story = { | ||
| render: () => ( | ||
| <HeaderBase | ||
| endAccessory={ | ||
| <ButtonIcon | ||
| iconName={IconName.Close} | ||
| size={ButtonIconSize.Md} | ||
| onPress={noop} | ||
| /> | ||
| } | ||
| > | ||
| With End Accessory | ||
| </HeaderBase> | ||
| ), | ||
| }; | ||
|
|
||
| export const BothAccessories: Story = { | ||
| render: () => ( | ||
| <HeaderBase | ||
| startAccessory={ | ||
| <ButtonIcon | ||
| iconName={IconName.ArrowLeft} | ||
| size={ButtonIconSize.Md} | ||
| onPress={noop} | ||
| /> | ||
| } | ||
| endAccessory={ | ||
| <ButtonIcon | ||
| iconName={IconName.Close} | ||
| size={ButtonIconSize.Md} | ||
| onPress={noop} | ||
| /> | ||
| } | ||
| > | ||
| Both Accessories | ||
| </HeaderBase> | ||
| ), | ||
| }; | ||
|
|
||
| export const Children: Story = { | ||
| render: () => ( | ||
| <HeaderBase | ||
| startButtonIconProps={{ | ||
| iconName: IconName.ArrowLeft, | ||
| onPress: noop, | ||
| }} | ||
| > | ||
| <Box twClassName="items-center"> | ||
| <Text variant={TextVariant.HeadingSm}>Custom Title</Text> | ||
| <Text variant={TextVariant.BodySm}>Subtitle text</Text> | ||
| </Box> | ||
| </HeaderBase> | ||
| ), | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove image as it can become out dated