-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change collection stats links, update deps (#1160)
* Use searchParams for release management options, change collection stats links * Upgrade react-toastify * Update deps
- Loading branch information
1 parent
97132b4
commit 9c1f70c
Showing
9 changed files
with
345 additions
and
318 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
Large diffs are not rendered by default.
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
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,43 @@ | ||
import React from 'react'; | ||
import type { ToastContentProps } from 'react-toastify'; | ||
import { mdiCloseCircleOutline } from '@mdi/js'; | ||
import { Icon } from '@mdi/react'; | ||
|
||
type Props = ToastContentProps<{ | ||
header: string; | ||
message?: React.ReactNode; | ||
icon: string; | ||
}>; | ||
|
||
const colorClass = { | ||
success: 'text-panel-text-important', | ||
error: 'text-panel-text-danger', | ||
info: 'text-panel-text-primary', | ||
warning: 'text-panel-text-warning', | ||
}; | ||
|
||
const isColorClass = (type: string): type is keyof typeof colorClass => type in colorClass; | ||
|
||
const ToastComponent = (props: Props) => { | ||
const { closeToast, data, toastProps } = props; | ||
const color = isColorClass(toastProps.type) ? toastProps?.type : 'info'; | ||
|
||
return ( | ||
<div className="flex bg-panel-background"> | ||
<span> | ||
<Icon path={data.icon} size={1} className={colorClass[color]} /> | ||
</span> | ||
<div className="ml-4 mr-8 flex grow flex-col"> | ||
<div className="font-semibold">{data.header}</div> | ||
<div className="text-panel-text">{data.message}</div> | ||
</div> | ||
{toastProps.autoClose && ( | ||
<span onClick={closeToast}> | ||
<Icon path={mdiCloseCircleOutline} size={1} className="text-panel-text opacity-65" /> | ||
</span> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default ToastComponent; |
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