generated from goitacademy/react-homework-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
245 additions
and
60 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import * as React from 'react'; | ||
import { cva } 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+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7', | ||
{ | ||
variants: { | ||
variant: { | ||
default: 'bg-background text-foreground', | ||
destructive: | ||
'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive', | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: 'default', | ||
}, | ||
} | ||
); | ||
|
||
const Alert = React.forwardRef(({ className, variant, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
role="alert" | ||
className={cn(alertVariants({ variant }), className)} | ||
{...props} | ||
/> | ||
)); | ||
Alert.displayName = 'Alert'; | ||
|
||
const AlertTitle = React.forwardRef(({ className, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn('mb-1 font-medium leading-none tracking-tight', className)} | ||
{...props} | ||
/> | ||
)); | ||
AlertTitle.displayName = 'AlertTitle'; | ||
|
||
const AlertDescription = React.forwardRef(({ className, ...props }, ref) => ( | ||
<div | ||
ref={ref} | ||
className={cn('text-sm [&_p]:leading-relaxed', className)} | ||
{...props} | ||
/> | ||
)); | ||
AlertDescription.displayName = 'AlertDescription'; | ||
|
||
export { Alert, AlertTitle, AlertDescription }; |
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,53 @@ | ||
import { | ||
ExclamationTriangleIcon, | ||
InfoCircledIcon, | ||
} from '@radix-ui/react-icons'; | ||
|
||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert'; | ||
|
||
export const AlertDestructive = ({ message }) => { | ||
return ( | ||
<Alert variant="destructive" className="max-w-2xl"> | ||
<ExclamationTriangleIcon className="h-4 w-4" /> | ||
<AlertTitle>Error</AlertTitle> | ||
<AlertDescription>{message}</AlertDescription> | ||
</Alert> | ||
); | ||
}; | ||
|
||
export const AlertInfo = () => { | ||
return ( | ||
<Alert className="max-w-2xl"> | ||
<InfoCircledIcon className="h-4 w-4 text-blue-500" /> | ||
<AlertTitle>No Search Results</AlertTitle> | ||
<AlertDescription> | ||
Your search did not match any movies. Please try again with different | ||
keywords or filters. | ||
</AlertDescription> | ||
</Alert> | ||
); | ||
}; | ||
|
||
export const AlertNoCast = () => { | ||
return ( | ||
<Alert className="max-w-2xl mt-8"> | ||
<InfoCircledIcon className="h-4 w-4 text-blue-500" /> | ||
<AlertTitle>No Cast Information</AlertTitle> | ||
<AlertDescription> | ||
There is no information available about the cast for this movie. | ||
</AlertDescription> | ||
</Alert> | ||
); | ||
}; | ||
|
||
export const AlertNoReviews = () => { | ||
return ( | ||
<Alert className="max-w-2xl mt-8"> | ||
<InfoCircledIcon className="h-4 w-4 text-blue-500" /> | ||
<AlertTitle>No Reviews Yet</AlertTitle> | ||
<AlertDescription> | ||
There are currently no reviews available for this movie. | ||
</AlertDescription> | ||
</Alert> | ||
); | ||
}; |
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
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
Oops, something went wrong.