mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-05-17 08:26:54 +08:00
feat: add base skeleton component (#11339)
This commit is contained in:
parent
16a65cb367
commit
5e2cb0e3a8
47
web/app/components/base/skeleton/index.tsx
Normal file
47
web/app/components/base/skeleton/index.tsx
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
import type { ComponentProps, FC } from 'react'
|
||||||
|
import classNames from '@/utils/classnames'
|
||||||
|
|
||||||
|
type SkeletonProps = ComponentProps<'div'>
|
||||||
|
|
||||||
|
export const SkeletonContanier: FC<SkeletonProps> = (props) => {
|
||||||
|
const { className, children, ...rest } = props
|
||||||
|
return (
|
||||||
|
<div className={classNames('flex flex-col gap-1', className)} {...rest}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SkeletonRow: FC<SkeletonProps> = (props) => {
|
||||||
|
const { className, children, ...rest } = props
|
||||||
|
return (
|
||||||
|
<div className={classNames('flex items-center gap-2', className)} {...rest}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SkeletonRectangle: FC<SkeletonProps> = (props) => {
|
||||||
|
const { className, children, ...rest } = props
|
||||||
|
return (
|
||||||
|
<div className={classNames('h-2 rounded-sm opacity-20 bg-text-tertiary my-1', className)} {...rest}>
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SkeletonPoint: FC = () =>
|
||||||
|
<div className='text-text-quaternary text-xs font-medium'>·</div>
|
||||||
|
|
||||||
|
/** Usage
|
||||||
|
* <SkeletonContanier>
|
||||||
|
* <SkeletonRow>
|
||||||
|
* <SkeletonRectangle className="w-96" />
|
||||||
|
* <SkeletonPoint />
|
||||||
|
* <SkeletonRectangle className="w-96" />
|
||||||
|
* </SkeletonRow>
|
||||||
|
* <SkeletonRow>
|
||||||
|
* <SkeletonRectangle className="w-96" />
|
||||||
|
* </SkeletonRow>
|
||||||
|
* <SkeletonRow>
|
||||||
|
*/
|
Loading…
x
Reference in New Issue
Block a user