Skip to content

Commit

Permalink
Merge pull request #67 from joshtyf/feature/implement-success-toast
Browse files Browse the repository at this point in the history
Implement success toast
  • Loading branch information
Ziyang-98 authored Feb 29, 2024
2 parents 52b6c8f + 4e29c65 commit 0d22d26
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const useServiceRequest = ({ pipelineId }: UseServiceRequestOptions) => {
title: "Request Submission Successful",
description:
"Please check the dashboard for the status of the request.",
variant: "success",
})
console.log("Response: ", data)
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ const useCreateService = ({ router }: UseCreateServiceProps) => {
toast({
title: "Service Creation Successful",
description: "Redirecting to service catalog...",
variant: "success",
})
setSubmitted(true)
setTimeout(() => router.push("/service-catalog"), 1500)
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/ui/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const toastVariants = cva(
default: "border bg-background text-foreground",
destructive:
"destructive group border-destructive bg-destructive text-destructive-foreground",
success:
"success group border-success bg-success text-success-foreground",
},
},
defaultVariants: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/ui/toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function Toaster() {
const { toasts } = useToast()

return (
<ToastProvider>
<ToastProvider duration={3000}>
{toasts.map(function ({ id, title, description, action, ...props }) {
return (
<Toast key={id} {...props}>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

--ring: 215 20.2% 65.1%;

--success: 130, 80%, 60%;
--success-foreground: 0, 0%, 20%;
--success: 131.9, 54.26%, 43.73%;
--success-foreground: 0 25% 90%;

--radius: 0.5rem;
}
Expand Down Expand Up @@ -73,8 +73,8 @@

--ring: 217.2 32.6% 17.5%;

--success: 130, 80%, 40%;
--success-foreground: 0, 0%, 80%;
--success: 131.9, 54.26%, 43.73%;
--success-foreground: 0 85.7% 97.3%;
}
}

Expand Down
4 changes: 4 additions & 0 deletions frontend/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const config = {
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
success: {
DEFAULT: "hsl(var(--success))",
foreground: "hsl(var(--success-foreground))",
},
muted: {
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
Expand Down

0 comments on commit 0d22d26

Please sign in to comment.