Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
💄 Update alert component (#1886)
Luke Vellafff09427c5b4
diff --git a/apps/web/src/app/[locale]/(optional-space)/poll/[urlId]/guest-poll-alert.tsx b/apps/web/src/app/[locale]/(optional-space)/poll/[urlId]/guest-poll-alert.tsxindex dabb2455b..b11f93baf 100644--- a/apps/web/src/app/[locale]/(optional-space)/poll/[urlId]/guest-poll-alert.tsx+++ b/apps/web/src/app/[locale]/(optional-space)/poll/[urlId]/guest-poll-alert.tsx@@ -20,25 +20,31 @@ export const GuestPollAlert = () => {return null;}return (- <Alert icon={InfoIcon}>- <AlertTitle className="mb-1 font-medium text-sm tracking-normal">+ <Alert>+ <InfoIcon />+ <AlertTitle><Transi18nKey="guestPollAlertTitle"defaults="Your administrator rights can be lost if you clear your cookies"/></AlertTitle>- <AlertDescription className="text-sm">- <Trans- i18nKey="guestPollAlertDescription"- defaults="<0>Create an account</0> or <1>login</1> to claim this poll."- components={[- <RegisterLink- className="underline hover:text-gray-800"- key="register"- />,- <LoginLink className="underline hover:text-gray-800" key="login" />,- ]}- />+ <AlertDescription>+ <p className="text-sm">+ <Trans+ i18nKey="guestPollAlertDescription"+ defaults="<0>Create an account</0> or <1>login</1> to claim this poll."+ components={[+ <RegisterLink+ className="underline hover:text-gray-800"+ key="register"+ />,+ <LoginLink+ className="underline hover:text-gray-800"+ key="login"+ />,+ ]}+ />+ </p></AlertDescription></Alert>);diff --git a/apps/web/src/app/[locale]/(space)/account/profile/profile-email-address.tsx b/apps/web/src/app/[locale]/(space)/account/profile/profile-email-address.tsxindex 5293c60ac..96b71f8c5 100644--- a/apps/web/src/app/[locale]/(space)/account/profile/profile-email-address.tsx+++ b/apps/web/src/app/[locale]/(space)/account/profile/profile-email-address.tsx@@ -127,7 +127,8 @@ export const ProfileEmailAddress = () => {)}/>{didRequestEmailChange ? (- <Alert icon={InfoIcon}>+ <Alert>+ <InfoIcon /><AlertTitle><Transi18nKey="emailChangeRequestSent"@@ -135,10 +136,12 @@ export const ProfileEmailAddress = () => {/></AlertTitle><AlertDescription>- <Trans- i18nKey="emailChangeRequestSentDescription"- defaults="To complete the change, please check your email for a verification link."- />+ <p>+ <Trans+ i18nKey="emailChangeRequestSentDescription"+ defaults="To complete the change, please check your email for a verification link."+ />+ </p></AlertDescription></Alert>) : null}diff --git a/apps/web/src/components/event-card.tsx b/apps/web/src/components/event-card.tsxindex 9a69cb6cf..f981f1e55 100644--- a/apps/web/src/components/event-card.tsx+++ b/apps/web/src/components/event-card.tsx@@ -90,15 +90,18 @@ export function EventCard() {</CardContent></Card>{poll.status === "paused" ? (- <Alert icon={PauseIcon}>+ <Alert>+ <PauseIcon /><AlertTitle><Trans i18nKey="pollStatusPaused" /></AlertTitle><AlertDescription>- <Trans- i18nKey="pollStatusPausedDescription"- defaults="Votes cannot be submitted or edited at this time"- />+ <p>+ <Trans+ i18nKey="pollStatusPausedDescription"+ defaults="Votes cannot be submitted or edited at this time"+ />+ </p></AlertDescription></Alert>) : null}diff --git a/apps/web/src/style.css b/apps/web/src/style.cssindex 50d11bdfc..a81ecb0a7 100644--- a/apps/web/src/style.css+++ b/apps/web/src/style.css@@ -2,6 +2,10 @@@tailwind components;@tailwind utilities;+:root {+ --spacing: 0.25rem;+}+@layer base {* {@apply border-border;diff --git a/packages/ui/src/alert.tsx b/packages/ui/src/alert.tsxindex ffbadd023..5f9bd9f59 100644--- a/packages/ui/src/alert.tsx+++ b/packages/ui/src/alert.tsx@@ -1,17 +1,17 @@import type { VariantProps } from "class-variance-authority";import { cva } from "class-variance-authority";-import * as React from "react";+import type * as React from "react";import { cn } from "./lib/utils";const alertVariants = cva(- "flex flex-col gap-x-3 gap-y-2 rounded-md border p-4 sm:flex-row",+ "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-lg border px-4 py-3 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants: {variant: {- default: "bg-gray-50 text-foreground",+ default: "bg-card text-card-foreground",destructive:- "border-destructive/50 bg-rose-50 text-destructive dark:border-destructive [&>svg]:text-destructive",+ "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 [&>svg]:text-current",},},defaultVariants: {@@ -20,56 +20,45 @@ const alertVariants = cva(},);-const Alert = React.forwardRef<- HTMLDivElement,- React.HTMLAttributes<HTMLDivElement> &- VariantProps<typeof alertVariants> & {- icon: React.ComponentType<{ className?: string }>;- }->(({ className, icon: Icon, children, variant, ...props }, ref) => (- <div- ref={ref}- role="alert"- className={cn(alertVariants({ variant }), className)}- {...props}- >- {Icon ? (- <Icon className="-mt-0.5 mb-2 size-5 text-muted-foreground" />- ) : null}- <div>{children}</div>- </div>-));-Alert.displayName = "Alert";+function Alert({+ className,+ variant,+ ...props+}: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>) {+ return (+ <div+ data-slot="alert"+ role="alert"+ className={cn(alertVariants({ variant }), className)}+ {...props}+ />+ );+}-Alert.displayName = "Alert";-const AlertTitle = React.forwardRef<- HTMLParagraphElement,- React.HTMLAttributes<HTMLHeadingElement>->(({ className, ...props }, ref) => (- <h5- ref={ref}- className={cn(- "mb-2 font-semibold text-sm leading-none tracking-tight",- className,- )}- {...props}- />-));-AlertTitle.displayName = "AlertTitle";+function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="alert-title"+ className={cn("col-start-2 line-clamp-1 min-h-4 font-medium", className)}+ {...props}+ />+ );+}-const AlertDescription = React.forwardRef<- HTMLParagraphElement,- React.HTMLAttributes<HTMLParagraphElement>->(({ className, ...props }, ref) => (- <div- ref={ref}- className={cn(- "text-muted-foreground text-sm [&_p]:leading-relaxed",- className,- )}- {...props}- />-));-AlertDescription.displayName = "AlertDescription";+function AlertDescription({+ className,+ ...props+}: React.ComponentProps<"div">) {+ return (+ <div+ data-slot="alert-description"+ className={cn(+ "col-start-2 grid justify-items-start gap-1 text-muted-foreground text-sm [&_p]:leading-relaxed",+ className,+ )}+ {...props}+ />+ );+}-export { Alert, AlertDescription, AlertTitle };+export { Alert, AlertTitle, AlertDescription };