Skip to content
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

Fix: modified ui for successful invite feedback #1332

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/components/common/modals/invite-member/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,8 @@ const InviteMemberModal: React.FC<ModalProperties> = ({ show, onClose }) => {
setError(response.error);
} else {
toast({
title: "Success",
description: "Your invite has been sent successfully to members' email",
variant: "default",
description: "1 Invite sent successfully.",
variant: "success",
});
setEmails("");
onClose();
Expand Down Expand Up @@ -113,8 +112,8 @@ const InviteMemberModal: React.FC<ModalProperties> = ({ show, onClose }) => {
if (document.hasFocus()) {
await navigator.clipboard.writeText(inviteLinkData);
toast({
title: "Invite Link",
description: "Invite link copied to clipboard!",
variant: "success",
});
} else {
setError("Failed to copy invite link. Please manually copy it.");
Expand Down
10 changes: 6 additions & 4 deletions src/components/ui/toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const ToastViewport = React.forwardRef<
<ToastPrimitives.Viewport
ref={reference}
className={cn(
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
"fixed left-1/2 top-0 z-[100] flex max-h-screen w-full -translate-x-1/2 flex-col-reverse p-4 sm:right-0 sm:top-0 sm:flex-col md:max-w-[420px]",
className,
)}
{...properties}
Expand All @@ -25,13 +25,15 @@ const ToastViewport = React.forwardRef<
ToastViewport.displayName = ToastPrimitives.Viewport.displayName;

const toastVariants = cva(
"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",
"group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-center",
{
variants: {
variant: {
default: "border bg-background text-foreground",
destructive:
"destructive group border-destructive bg-destructive text-destructive-foreground",
success:
"success group border-[#5FC96A] bg-[#E7F7E9] text-[1rem] leadig-[19.2px] text-black",
},
},
defaultVariants: {
Expand Down Expand Up @@ -77,13 +79,13 @@ const ToastClose = React.forwardRef<
<ToastPrimitives.Close
ref={reference}
className={cn(
"custom-close-btn absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
"custom-close-btn absolute right-2 top-[27%] rounded-md p-1 text-foreground/50 opacity-100 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",
className,
)}
toast-close=""
{...properties}
>
<X className="h-4 w-4" />
<X className="h-4 w-4 text-black" />
</ToastPrimitives.Close>
));
ToastClose.displayName = ToastPrimitives.Close.displayName;
Expand Down
Loading