refactor(icons): install and use @heroicons/react (#1438)
This commit is contained in:
@@ -1,98 +1,41 @@
|
||||
import {
|
||||
CheckCircleIcon,
|
||||
ExclamationCircleIcon,
|
||||
ExclamationIcon,
|
||||
InformationCircleIcon,
|
||||
} from '@heroicons/react/outline';
|
||||
import { XIcon } from '@heroicons/react/solid';
|
||||
import React from 'react';
|
||||
import type { ToastProps } from 'react-toast-notifications';
|
||||
|
||||
const Toast: React.FC<ToastProps> = ({ appearance, children, onDismiss }) => {
|
||||
return (
|
||||
<div className="toast flex items-end justify-center px-2 py-2 pointer-events-none sm:items-start sm:justify-end">
|
||||
<div className="max-w-sm w-full bg-gray-700 shadow-lg rounded-lg pointer-events-auto">
|
||||
<div className="rounded-lg ring-1 ring-black ring-opacity-5 overflow-hidden">
|
||||
<div className="flex items-end justify-center px-2 py-2 pointer-events-none toast sm:items-start sm:justify-end">
|
||||
<div className="w-full max-w-sm bg-gray-700 rounded-lg shadow-lg pointer-events-auto">
|
||||
<div className="overflow-hidden rounded-lg ring-1 ring-black ring-opacity-5">
|
||||
<div className="p-4">
|
||||
<div className="flex items-start">
|
||||
<div className="flex-shrink-0">
|
||||
{appearance === 'success' && (
|
||||
<svg
|
||||
className="h-6 w-6 text-green-400"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth="2"
|
||||
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
/>
|
||||
</svg>
|
||||
<CheckCircleIcon className="w-6 h-6 text-green-400" />
|
||||
)}
|
||||
|
||||
{appearance === 'error' && (
|
||||
<svg
|
||||
className="w-6 h-6 text-red-500"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
/>
|
||||
</svg>
|
||||
<ExclamationCircleIcon className="w-6 h-6 text-red-500" />
|
||||
)}
|
||||
|
||||
{appearance === 'info' && (
|
||||
<svg
|
||||
className="w-6 h-6 text-indigo-500"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
/>
|
||||
</svg>
|
||||
<InformationCircleIcon className="w-6 h-6 text-indigo-500" />
|
||||
)}
|
||||
|
||||
{appearance === 'warning' && (
|
||||
<svg
|
||||
className="w-6 h-6 text-orange-400"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
||||
/>
|
||||
</svg>
|
||||
<ExclamationIcon className="w-6 h-6 text-orange-400" />
|
||||
)}
|
||||
</div>
|
||||
<div className="ml-3 w-0 flex-1 text-white">{children}</div>
|
||||
<div className="ml-4 flex-shrink-0 flex">
|
||||
<div className="flex-1 w-0 ml-3 text-white">{children}</div>
|
||||
<div className="flex flex-shrink-0 ml-4">
|
||||
<button
|
||||
onClick={() => onDismiss()}
|
||||
className="inline-flex text-gray-400 focus:outline-none focus:text-gray-500 transition ease-in-out duration-150"
|
||||
className="inline-flex text-gray-400 transition duration-150 ease-in-out focus:outline-none focus:text-gray-500"
|
||||
>
|
||||
<svg
|
||||
className="h-5 w-5"
|
||||
viewBox="0 0 20 20"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
<XIcon className="w-5 h-5" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user