-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: clean up / styling adjustments in new toast components
- Loading branch information
Showing
8 changed files
with
85 additions
and
273 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
apps/marginfi-v2-ui/src/components/common/Toast/ErrorToast.tsx
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,21 @@ | ||
import { FC } from "react"; | ||
import { IconAlertTriangle } from "~/components/ui/icons"; | ||
|
||
export interface ErrorToastProps { | ||
title: string; | ||
message: string; | ||
} | ||
|
||
export const ErrorToast: FC<ErrorToastProps> = ({ title, message }) => { | ||
return ( | ||
<div className="w-full h-full bg-black text-white rounded-lg shadow-lg z-50 p-1"> | ||
<h2 className="text-lg font-semibold">{title}</h2> | ||
<div className="py-3 text-sm"> | ||
<div className="flex items-center space-x-2"> | ||
<p className="text-red-400">{message}</p> | ||
<IconAlertTriangle size={18} className="text-red-400" /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
45 changes: 45 additions & 0 deletions
45
apps/marginfi-v2-ui/src/components/common/Toast/MultiStepToast.tsx
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,45 @@ | ||
import { FC } from "react"; | ||
import { IconLoader, IconCheck, IconAlertTriangle, IconClockHour4 } from "~/components/ui/icons"; | ||
|
||
export interface MultiStepToastProps { | ||
title: string; | ||
steps: ToastStepWithStatus[]; | ||
} | ||
|
||
export interface ToastStep { | ||
label: string; | ||
} | ||
|
||
export type ToastStatus = "todo" | "pending" | "success" | "error" | "canceled"; | ||
|
||
export interface ToastStepWithStatus extends ToastStep { | ||
status: ToastStatus; | ||
message?: string; | ||
} | ||
|
||
export const MultiStepToast: FC<MultiStepToastProps> = ({ title, steps }) => { | ||
return ( | ||
<div className="w-full h-full bg-black text-white rounded-lg shadow-lg z-50 p-1"> | ||
<h2 className="text-lg font-semibold">{title}</h2> | ||
<div className="py-3 text-sm space-y-2"> | ||
{steps.map((step, index) => ( | ||
<div key={index}> | ||
<div className="flex items-center space-x-2"> | ||
<h3>{step.label}</h3> | ||
{step.status === "success" ? ( | ||
<IconCheck size={18} className="text-green-400" /> | ||
) : step.status === "error" ? ( | ||
<IconAlertTriangle size={18} className="text-red-400" /> | ||
) : step.status === "pending" ? ( | ||
<IconLoader size={18} /> | ||
) : ( | ||
<IconClockHour4 size={18} /> | ||
)} | ||
</div> | ||
{step.message && <p className="text-red-400 mt-1">{step.message}</p>} | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; |
File renamed without changes.
35 changes: 0 additions & 35 deletions
35
apps/marginfi-v2-ui/src/components/common/toasts/ErrorToast.tsx
This file was deleted.
Oops, something went wrong.
88 changes: 0 additions & 88 deletions
88
apps/marginfi-v2-ui/src/components/common/toasts/MultiStepToast.tsx
This file was deleted.
Oops, something went wrong.
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.