add divider label component

This commit is contained in:
Pavel Prichodko 2023-01-19 23:55:51 +01:00
parent 9ea3ffb8f8
commit 3c2dc7cbc8
No known key found for this signature in database
GPG Key ID: 8E4C82D464215E83
3 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,25 @@
import { DividerLabel } from './divider-label'
import type { Meta, StoryObj } from '@storybook/react'
// More on how to set up stories at: https://storybook.js.org/docs/7.0/react/writing-stories/introduction
const meta: Meta<typeof DividerLabel> = {
component: DividerLabel,
argTypes: {},
parameters: {
design: {
type: 'figma',
url: '',
},
},
}
type Story = StoryObj<typeof DividerLabel>
export const Default: Story = {
args: {
label: 'Messages',
},
}
export default meta

View File

@ -0,0 +1,29 @@
import { Stack } from '@tamagui/core'
import { Paragraph } from '../typography'
type Props = {
label: string
tight?: boolean
}
const DividerLabel = (props: Props) => {
const { label, tight = true } = props
return (
<Stack
paddingHorizontal={16}
paddingTop={tight ? 8 : 16}
paddingBottom={8}
borderColor="$neutral-10"
borderTopWidth={1}
>
<Paragraph color="$neutral-50" weight="medium" variant="smaller">
{label}
</Paragraph>
</Stack>
)
}
export { DividerLabel }
export type { Props as DividerLabelProps }

View File

@ -0,0 +1 @@
export * from './divider-label'