feat: preview container components
parent
11679dc68a
commit
90421b5fb5
@ -0,0 +1,23 @@
|
||||
import type { FC } from 'react'
|
||||
import type { DividerProps } from '.'
|
||||
import Divider from '.'
|
||||
import classNames from '@/utils/classnames'
|
||||
|
||||
export type DividerWithLabelProps = DividerProps & {
|
||||
label: string
|
||||
}
|
||||
|
||||
export const DividerWithLabel: FC<DividerWithLabelProps> = (props) => {
|
||||
const { label, className, ...rest } = props
|
||||
return <div
|
||||
className="flex items-center gap-2 my-2"
|
||||
>
|
||||
<Divider {...rest} className={classNames('flex-1', className)} />
|
||||
<span className="text-text-tertiary text-xs">
|
||||
{label}
|
||||
</span>
|
||||
<Divider {...rest} className={classNames('flex-1', className)} />
|
||||
</div>
|
||||
}
|
||||
|
||||
export default DividerWithLabel
|
||||
@ -0,0 +1,27 @@
|
||||
import type { ComponentProps, FC, ReactNode } from 'react'
|
||||
import { forwardRef } from 'react'
|
||||
import classNames from '@/utils/classnames'
|
||||
|
||||
export type PreviewContainerProps = ComponentProps<'div'> & {
|
||||
header: ReactNode
|
||||
}
|
||||
|
||||
export const PreviewContainer: FC<PreviewContainerProps> = forwardRef((props, ref) => {
|
||||
const { children, className, header, ...rest } = props
|
||||
return <div
|
||||
{...rest}
|
||||
ref={ref}
|
||||
className={classNames(
|
||||
'flex flex-col rounded-xl border-t-[0.5px] border-l-[0.5px] border-components-panel-border bg-background-default-lighter shadow shadow-shadow-shadow-5',
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<header className='py-4 pl-5 pr-3 border-b border-divider-subtle'>
|
||||
{header}
|
||||
</header>
|
||||
<main className='py-5 px-6'>
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
})
|
||||
PreviewContainer.displayName = 'PreviewContainer'
|
||||
@ -0,0 +1,23 @@
|
||||
import type { ComponentProps, FC } from 'react'
|
||||
import classNames from '@/utils/classnames'
|
||||
|
||||
export type PreviewHeaderProps = Omit<ComponentProps<'div'>, 'title'> & {
|
||||
title: string
|
||||
}
|
||||
|
||||
export const PreviewHeader: FC<PreviewHeaderProps> = (props) => {
|
||||
const { title, className, children, ...rest } = props
|
||||
return <div
|
||||
{...rest}
|
||||
className={classNames(
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className='text-text-accent text-2xs font-semibold leading-3 uppercase'
|
||||
>
|
||||
{title}
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
}
|
||||
Loading…
Reference in New Issue