File tree Expand file tree Collapse file tree 8 files changed +88
-0
lines changed
playground/src/app/(demo)/skeleton Expand file tree Collapse file tree 8 files changed +88
-0
lines changed Original file line number Diff line number Diff line change 1+ import { cn } from '@/lib/utils' ;
2+
3+ import { skeletonVariants } from './skeleton-variants' ;
4+ import type { SkeletonProps } from './types' ;
5+
6+ function Skeleton ( props : SkeletonProps ) {
7+ const { className, ...rest } = props ;
8+
9+ const mergedCls = cn ( skeletonVariants ( ) , className ) ;
10+
11+ return (
12+ < div
13+ className = { mergedCls }
14+ data-slot = "skeleton"
15+ { ...rest }
16+ />
17+ ) ;
18+ }
19+
20+ export default Skeleton ;
Original file line number Diff line number Diff line change 1+ export { default as Skeleton } from './Skeleton' ;
2+
3+ export * from './types' ;
Original file line number Diff line number Diff line change 1+ import { tv } from 'tailwind-variants' ;
2+
3+ export const skeletonVariants = tv ( {
4+ base : `animate-pulse rounded-md bg-accent-foreground/10`
5+ } ) ;
Original file line number Diff line number Diff line change 1+ import type { BaseComponentProps } from '@/types/other' ;
2+
3+ export type SkeletonProps = BaseComponentProps < 'div' > ;
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ export * from './components/collapsible';
2626
2727export * from './components/config-provider' ;
2828
29+ export * from './components/context-menu' ;
30+
2931export * from './components/divider' ;
3032
3133export * from './components/dropdown-menu' ;
@@ -40,6 +42,8 @@ export * from './components/popover';
4042
4143export * from './components/scroll-area' ;
4244
45+ export * from './components/skeleton' ;
46+
4347export * from './components/sonner' ;
4448
4549export * from './components/switch' ;
Original file line number Diff line number Diff line change 1+ import { Card , Skeleton } from 'soybean-react-ui' ;
2+
3+ const CustomSize = ( ) => {
4+ return (
5+ < Card
6+ split
7+ title = "Custom Size"
8+ >
9+ < div className = "flex flex-col space-y-3" >
10+ < Skeleton className = "h-[125px] w-[250px] rounded-xl" />
11+ < div className = "space-y-2" >
12+ < Skeleton className = "h-4 w-[250px]" />
13+ < Skeleton className = "h-4 w-[200px]" />
14+ </ div >
15+ </ div >
16+ </ Card >
17+ ) ;
18+ } ;
19+
20+ export default CustomSize ;
Original file line number Diff line number Diff line change 1+ import { Card , Skeleton } from 'soybean-react-ui' ;
2+
3+ const DefaultDemo = ( ) => {
4+ return (
5+ < Card
6+ split
7+ title = "Skeleton"
8+ >
9+ < div className = "flex items-center space-x-4" >
10+ < Skeleton className = "size-12 rounded-full" />
11+ < div className = "space-y-2" >
12+ < Skeleton className = "h-4 w-[250px]" />
13+ < Skeleton className = "h-4 w-[200px]" />
14+ </ div >
15+ </ div >
16+ </ Card >
17+ ) ;
18+ } ;
19+
20+ export default DefaultDemo ;
Original file line number Diff line number Diff line change 1+ import CustomSize from './modules/CustomSize' ;
2+ import DefaultDemo from './modules/DefaultDemo' ;
3+
4+ const SkeletonPage = ( ) => {
5+ return (
6+ < div className = "flex-c gap-4" >
7+ < DefaultDemo />
8+ < CustomSize />
9+ </ div >
10+ ) ;
11+ } ;
12+
13+ export default SkeletonPage ;
You can’t perform that action at this time.
0 commit comments