Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
idimetrix committed Sep 25, 2024
1 parent fe620e7 commit dea98b2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ https://colornamer.robertcooper.me/
## Fontawesome

https://fontawesome.com/search?q=


## Sources

https://github.com/themesberg/flowbite-react
27 changes: 5 additions & 22 deletions components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
import Link from "next/link"
import { ForwardedRef, forwardRef, HTMLAttributeAnchorTarget, HTMLAttributes } from "react"
import { tv, VariantProps } from "tailwind-variants"
import { VariantProps } from "tailwind-variants"
import { AlertTheme } from "./theme"
import { cn } from "../../utils"

const alert = tv({
base: "border-opacity-20 px-5 py-3 border bg-opacity-20 rounded-lg",
variants: {
variant: {
primary: "text-primary-800 bg-primary-500 border-primary-500",
secondary: "text-secondary-800 dark:text-secondary-200 bg-secondary-500 border-secondary-500",
success: "text-success-800 bg-success-500 border-success-500 bg-opacity-10 border-opacity-10",
danger: "text-danger-800 bg-danger-500 border-danger-500",
warning: "text-warning-800 bg-warning-500 border-warning-500",
info: "text-info-800 bg-info-500 border-info-500",
dark: "text-dark-800 dark:text-dark-200 bg-dark-500 border-dark-500",
},
},
defaultVariants: {
variant: "primary",
},
})

export interface AlertVariants extends VariantProps<typeof alert> {}
export interface AlertVariants extends VariantProps<typeof AlertTheme> {}

export interface AlertProps extends HTMLAttributes<HTMLButtonElement | HTMLAnchorElement>, AlertVariants {
hover?: boolean
Expand All @@ -42,7 +25,7 @@ export const Alert = forwardRef<HTMLAnchorElement | HTMLButtonElement, AlertProp
ref={ref as ForwardedRef<HTMLAnchorElement>}
href={href}
target={target}
className={cn("relative", alert({ variant }), rounded && "rounded-full", className)}
className={cn("relative", AlertTheme({ variant }), rounded && "rounded-full", className)}
{...rest}
>
{children}
Expand All @@ -53,7 +36,7 @@ export const Alert = forwardRef<HTMLAnchorElement | HTMLButtonElement, AlertProp
type={type}
ref={ref as ForwardedRef<HTMLButtonElement>}
disabled={disabled}
className={cn("relative", alert({ variant }), rounded && "rounded-full", className)}
className={cn("relative", AlertTheme({ variant }), rounded && "rounded-full", className)}
{...rest}
>
{children}
Expand Down
19 changes: 19 additions & 0 deletions components/Alert/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { tv } from "tailwind-variants"

export const AlertTheme = tv({
base: "border-opacity-20 px-5 py-3 border bg-opacity-20 rounded-lg",
variants: {
variant: {
primary: "text-primary-800 bg-primary-500 border-primary-500",
secondary: "text-secondary-800 dark:text-secondary-200 bg-secondary-500 border-secondary-500",
success: "text-success-800 bg-success-500 border-success-500 bg-opacity-10 border-opacity-10",
danger: "text-danger-800 bg-danger-500 border-danger-500",
warning: "text-warning-800 bg-warning-500 border-warning-500",
info: "text-info-800 bg-info-500 border-info-500",
dark: "text-dark-800 dark:text-dark-200 bg-dark-500 border-dark-500",
},
},
defaultVariants: {
variant: "primary",
},
})
2 changes: 1 addition & 1 deletion tsconfig.tsbuildinfo

Large diffs are not rendered by default.

0 comments on commit dea98b2

Please sign in to comment.