- Notifications
You must be signed in to change notification settings - Fork 0
Cleanup obsolete document flow#24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
3cd7a04a218be626f915cc0acfb3141149794c871aa2c625ca7ae10fd1e01abFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import * as React from "react"; | ||
| import { AlertCircleIcon } from "lucide-react"; | ||
| import { cva, type VariantProps } from "class-variance-authority"; | ||
| import { cn } from "~/lib/utils"; | ||
| const alertVariants = cva( | ||
| "relative w-full rounded-lg border px-4 py-3 text-sm [&_svg]:text-foreground", | ||
| { | ||
| variants: { | ||
| variant: { | ||
| default: "bg-background text-foreground", | ||
| destructive: "bg-sidebar text-destructive [&_svg]:text-destructive", | ||
| }, | ||
| }, | ||
| defaultVariants: { | ||
| variant: "default", | ||
| }, | ||
| }, | ||
| ); | ||
| const AlertContext = | ||
| React.createContext<VariantProps<typeof alertVariants>["variant"]>("default"); | ||
| const Alert = React.forwardRef< | ||
| HTMLDivElement, | ||
| React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants> | ||
| >(({ className, variant = "default", children, ...props }, ref) => ( | ||
| <AlertContext.Provider value={variant}> | ||
| <div | ||
| ref={ref} | ||
| role="alert" | ||
| className={cn(alertVariants({ variant }), className)} | ||
| {...props} | ||
| > | ||
| {children} | ||
| </div> | ||
| </AlertContext.Provider> | ||
| )); | ||
| Alert.displayName = "Alert"; | ||
| const AlertTitle = React.forwardRef< | ||
| HTMLParagraphElement, | ||
| React.HTMLAttributes<HTMLHeadingElement> | ||
| >(({ className, ...props }, ref) => { | ||
| const variant = React.useContext(AlertContext); | ||
| const title = ( | ||
| <h5 | ||
| ref={ref} | ||
| className={cn("mb-2 font-medium leading-none tracking-tight", className)} | ||
| {...props} | ||
| /> | ||
| ); | ||
| if (variant === "destructive") { | ||
| return ( | ||
| <div className="mb-2 flex items-center gap-2 [&>*:last-child]:mb-0"> | ||
| <AlertCircleIcon className="h-4 w-4 shrink-0" aria-hidden /> | ||
| {title} | ||
| </div> | ||
| ); | ||
| } | ||
| return title; | ||
| }); | ||
| AlertTitle.displayName = "AlertTitle"; | ||
| const AlertDescription = React.forwardRef< | ||
| HTMLParagraphElement, | ||
| React.HTMLAttributes<HTMLParagraphElement> | ||
Comment on lines
+68
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ref type mismatch: Same issue as Suggested fix-const AlertDescription = React.forwardRef<- HTMLParagraphElement,- React.HTMLAttributes<HTMLParagraphElement>->(({ className, ...props }, ref) => {+const AlertDescription = React.forwardRef<+ HTMLDivElement,+ React.HTMLAttributes<HTMLDivElement>+>(({ className, ...props }, ref) => {🤖 Prompt for AI Agents | ||
| >(({ className, ...props }, ref) => { | ||
| const variant = React.useContext(AlertContext); | ||
| return ( | ||
| <div | ||
| ref={ref} | ||
| className={cn( | ||
| "text-sm [&_p]:leading-relaxed", | ||
| variant === "destructive" && "pl-6", | ||
| className, | ||
| )} | ||
| {...props} | ||
| /> | ||
| ); | ||
| }); | ||
| AlertDescription.displayName = "AlertDescription"; | ||
| export { Alert, AlertTitle, AlertDescription }; | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| export function DocumentLoadingSkeleton() { | ||
| return ( | ||
| <div className="animate-pulse space-y-4"> | ||
| <div className="h-9 w-2/3 rounded-lg bg-muted" /> | ||
| <div className="space-y-3"> | ||
| <div className="h-4 rounded bg-muted" /> | ||
| <div className="h-4 w-[95%] rounded bg-muted" /> | ||
| <div className="h-4 w-[90%] rounded bg-muted" /> | ||
| </div> | ||
| <div className="space-y-3 pt-4"> | ||
| <div className="h-4 w-[85%] rounded bg-muted" /> | ||
| <div className="h-4 w-[88%] rounded bg-muted" /> | ||
| <div className="h-4 w-[92%] rounded bg-muted" /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref type mismatch:
HTMLParagraphElementbut the element is<h5>.AlertTitleforwards a ref typed asHTMLParagraphElement, but it renders an<h5>(which isHTMLHeadingElement). A consumer assigning the ref and calling heading-specific DOM methods (or relying on TypeScript narrowing) will get incorrect types.Suggested fix
📝 Committable suggestion
🤖 Prompt for AI Agents