-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shared/ui/cuhacking/components): create glassmorphic cards
- Loading branch information
1 parent
dfa272a
commit 57b873a
Showing
2 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
libs/shared/ui/src/cuHacking/components/glassmorphic-card/glassmorphic-card.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { ReactNode } from 'react' | ||
import InfoIcon from '@cuhacking/shared/assets/icons/general/info-1.svg' | ||
import { cn } from '@shadcn/lib/utils' | ||
import { cva } from 'class-variance-authority' | ||
import React from 'react' | ||
|
||
interface GlassmorphicCardProps { | ||
children: ReactNode | ||
variant?: 'default' | 'nested' | 'info' | ||
className?: string | ||
} | ||
|
||
const glassmorphicCardVariants = cva( | ||
'relative border backdrop-blur-md rounded-xl shadow-dropShadow border-border', | ||
{ | ||
variants: { | ||
variant: { | ||
default: 'bg-card', | ||
nested: 'bg-card-nested', | ||
info: 'bg-card', | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: 'default', | ||
}, | ||
}, | ||
) | ||
|
||
export function GlassmorphicCard({ children, variant = 'default', className }: GlassmorphicCardProps) { | ||
return ( | ||
<div className={cn(glassmorphicCardVariants({ variant, className }))}> | ||
{variant === 'info' | ||
? ( | ||
<div className="absolute top-1.5 right-1.5"> | ||
<img src={InfoIcon.src} /> | ||
</div> | ||
) | ||
: null} | ||
{children} | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
libs/shared/ui/src/cuHacking/components/glassmorphic-card/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { GlassmorphicCard } from './glassmorphic-card' |