-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add new modern glassy alert component
- Loading branch information
1 parent
901b152
commit 8a87143
Showing
4 changed files
with
108 additions
and
1 deletion.
There are no files selected for viewing
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
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
46 changes: 46 additions & 0 deletions
46
src/ui/cuicui/application-ui/alert/modern-glassy-alert/modern-glassy-alert.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,46 @@ | ||
import { XIcon } from "lucide-react"; | ||
import { cn } from "#/src/utils/cn"; | ||
|
||
import type { HTMLAttributes } from "react"; | ||
|
||
interface ModernGlassyAlertProps extends HTMLAttributes<HTMLDivElement> { | ||
className?: string; | ||
badge?: string; | ||
children?: React.ReactNode; | ||
href?: string; | ||
} | ||
|
||
export default function ModernGlassyAlert({ | ||
className, | ||
badge, | ||
children, | ||
href, | ||
...props | ||
}: Readonly<ModernGlassyAlertProps>) { | ||
return ( | ||
<div className="pointer-events-none fixed inset-x-0 bottom-0 z-10 sm:flex sm:justify-center sm:px-6 sm:pb-5 lg:px-8"> | ||
<div | ||
className={cn( | ||
"pointer-events-auto flex items-center justify-between gap-x-6 bg-black/25 px-6 py-2.5 backdrop-blur-md sm:rounded-xl sm:py-3 sm:pl-4 sm:pr-3.5", | ||
className, | ||
)} | ||
{...props} | ||
> | ||
<p className="text-sm leading-6 text-white"> | ||
<a href={href}> | ||
{children} | ||
{badge && ( | ||
<span className="ml-1 cursor-pointer rounded-full bg-white px-2 py-0.5 text-sm font-medium text-black"> | ||
{badge} | ||
</span> | ||
)} | ||
</a> | ||
</p> | ||
<button type="button" className="-m-1.5 flex-none p-1.5"> | ||
<span className="sr-only">Dismiss</span> | ||
<XIcon className="size-5 text-white" /> | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
} |
12 changes: 12 additions & 0 deletions
12
src/ui/cuicui/application-ui/alert/modern-glassy-alert/preview-modern-glassy-alert.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,12 @@ | ||
import ModernGlassyAlert from "#/src/ui/cuicui/application-ui/alert/modern-glassy-alert/modern-glassy-alert"; | ||
|
||
export default function PreviewModernGlassyAlert() { | ||
return ( | ||
<ModernGlassyAlert | ||
badge="Cuicui 🐤" | ||
href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" | ||
> | ||
The new alert component is now available! Check it out! | ||
</ModernGlassyAlert> | ||
); | ||
} |