From ff3f90ac940ab07446e23e36c454096540c444ab Mon Sep 17 00:00:00 2001 From: Pablo Lara Date: Mon, 5 Aug 2024 09:39:18 +0200 Subject: [PATCH] chore: replace CrossIcon for the toast and change variants when error --- components/icons/Icons.tsx | 46 ++++++++++++++++++- components/providers/AddProvider.tsx | 5 +- .../providers/CheckConnectionProvider.tsx | 3 +- components/providers/DeleteProvider.tsx | 3 +- components/ui/toast/Toast.tsx | 8 ++-- 5 files changed, 56 insertions(+), 9 deletions(-) diff --git a/components/icons/Icons.tsx b/components/icons/Icons.tsx index 647589639c..485baf39d4 100644 --- a/components/icons/Icons.tsx +++ b/components/icons/Icons.tsx @@ -329,7 +329,7 @@ export const DeleteIcon: React.FC = ({ ); export const CheckIcon: React.FC = ({ - size = 48, + size = 24, width, height, ...props @@ -348,6 +348,50 @@ export const CheckIcon: React.FC = ({ ); +export const CrossIcon: React.FC = ({ + size = 24, + width, + height, + ...props +}) => ( + + + +); + +export const PassIcon: React.FC = ({ + size = 24, + width, + height, + ...props +}) => ( + + + + + + +); + export const RocketIcon: React.FC = ({ size = 24, width, diff --git a/components/providers/AddProvider.tsx b/components/providers/AddProvider.tsx index 74f429e4c6..ba914f01fd 100644 --- a/components/providers/AddProvider.tsx +++ b/components/providers/AddProvider.tsx @@ -21,8 +21,9 @@ export const AddProvider = () => { const errorMessage = `${error.detail}`; // show error toast({ - title: "Wops! Something went wrong", - description: errorMessage, + variant: "destructive", + title: "Ups! Something went wrong", + description: errorMessage }); }); } else { diff --git a/components/providers/CheckConnectionProvider.tsx b/components/providers/CheckConnectionProvider.tsx index c8f1b190b7..598b93df66 100644 --- a/components/providers/CheckConnectionProvider.tsx +++ b/components/providers/CheckConnectionProvider.tsx @@ -21,7 +21,8 @@ export const CheckConnectionProvider = ({ id }: { id: string }) => { const errorMessage = `${error.detail}`; // show error toast({ - title: "Wops! Something went wrong", + variant: "destructive", + title: "Ups! Something went wrong", description: errorMessage, }); } else { diff --git a/components/providers/DeleteProvider.tsx b/components/providers/DeleteProvider.tsx index 8a269e13d7..6d5b476253 100644 --- a/components/providers/DeleteProvider.tsx +++ b/components/providers/DeleteProvider.tsx @@ -21,7 +21,8 @@ export const DeleteProvider = ({ id }: { id: string }) => { const errorMessage = `${error.detail}`; // show error toast({ - title: "Wops! Something went wrong", + variant: "destructive", + title: "Ups! Something went wrong", description: errorMessage, }); } else { diff --git a/components/ui/toast/Toast.tsx b/components/ui/toast/Toast.tsx index a00afa8fdd..dba0e5a784 100644 --- a/components/ui/toast/Toast.tsx +++ b/components/ui/toast/Toast.tsx @@ -1,10 +1,10 @@ "use client"; -import { Cross2Icon } from "@radix-ui/react-icons"; import * as ToastPrimitives from "@radix-ui/react-toast"; import { cva, type VariantProps } from "class-variance-authority"; import * as React from "react"; +import { CrossIcon } from "@/components/icons"; import { cn } from "@/lib/utils"; const ToastProvider = ToastPrimitives.Provider; @@ -84,7 +84,7 @@ const ToastClose = React.forwardRef< toast-close="" {...props} > - + )); ToastClose.displayName = ToastPrimitives.Close.displayName; @@ -95,7 +95,7 @@ const ToastTitle = React.forwardRef< >(({ className, ...props }, ref) => ( )); @@ -107,7 +107,7 @@ const ToastDescription = React.forwardRef< >(({ className, ...props }, ref) => ( ));