add divider label component

This commit is contained in:
Pavel Prichodko 2023-01-19 23:55:51 +01:00
parent 01a70d2ec1
commit 1633af603c
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
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'