-
-
Notifications
You must be signed in to change notification settings - Fork 779
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Innei <i@innei.in>
- Loading branch information
Showing
18 changed files
with
211 additions
and
150 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use client' | ||
|
||
import { Toaster } from 'sonner' | ||
|
||
import { useIsDark } from '~/hooks/common/use-is-dark' | ||
|
||
export const SonnerContainer = () => { | ||
const isDark = useIsDark() | ||
return ( | ||
<Toaster | ||
richColors | ||
closeButton | ||
duration={6666} | ||
theme={isDark ? 'dark' : 'light'} | ||
/> | ||
) | ||
} |
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
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,22 @@ | ||
import { useEffect } from 'react' | ||
import { toast, Toaster } from 'sonner' | ||
|
||
export const Sonner = () => { | ||
useEffect(() => { | ||
requestAnimationFrame(() => { | ||
toast.success('ss', { | ||
action: { | ||
label: 'test', | ||
onClick(event) { | ||
console.log(event) | ||
}, | ||
}, | ||
}) | ||
}) | ||
}, []) | ||
return ( | ||
<> | ||
<Toaster closeButton richColors /> | ||
</> | ||
) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,64 @@ | ||
'use client' | ||
// 'use client' | ||
|
||
import { useId } from 'react' | ||
import clsx from 'clsx' | ||
import { m } from 'framer-motion' | ||
import type { FC } from 'react' | ||
import type { ToastProps, TypeOptions } from 'react-toastify/dist/types' | ||
// import { useId } from 'react' | ||
// import clsx from 'clsx' | ||
// import { m } from 'framer-motion' | ||
// import type { FC } from 'react' | ||
// import type { ToastProps, TypeOptions } from 'react-toastify/dist/types' | ||
|
||
import { MotionButtonBase } from '../../ui/button' | ||
// import { MotionButtonBase } from '../../ui/button' | ||
|
||
const typeMap: Record<TypeOptions, JSX.Element> = { | ||
success: <i className="icon-[mingcute--check-fill] text-uk-green-light" />, | ||
error: <i className="icon-[mingcute--close-fill] text-uk-red-light" />, | ||
info: <i className="icon-[mingcute--information-fill] text-uk-blue-light" />, | ||
warning: <i className="icon-[mingcute--alert-fill] text-uk-orange-light" />, | ||
default: ( | ||
<i className="icon-[mingcute--information-fill] text-uk-blue-light" /> | ||
), | ||
} | ||
// const typeMap: Record<TypeOptions, JSX.Element> = { | ||
// success: <i className="icon-[mingcute--check-fill] text-uk-green-light" />, | ||
// error: <i className="icon-[mingcute--close-fill] text-uk-red-light" />, | ||
// info: <i className="icon-[mingcute--information-fill] text-uk-blue-light" />, | ||
// warning: <i className="icon-[mingcute--alert-fill] text-uk-orange-light" />, | ||
// default: ( | ||
// <i className="icon-[mingcute--information-fill] text-uk-blue-light" /> | ||
// ), | ||
// } | ||
|
||
export const ToastCard: FC<{ | ||
message: string | ||
toastProps?: ToastProps | ||
iconElement?: JSX.Element | ||
closeToast?: () => void | ||
onClick?: () => void | ||
}> = (props) => { | ||
const { iconElement, message, closeToast, onClick } = props | ||
const id = useId() | ||
// export const ToastCard: FC<{ | ||
// message: string | ||
// toastProps?: ToastProps | ||
// iconElement?: JSX.Element | ||
// closeToast?: () => void | ||
// onClick?: () => void | ||
// }> = (props) => { | ||
// const { iconElement, message, closeToast, onClick } = props | ||
// const id = useId() | ||
|
||
const MotionTag = onClick ? m.button : m.div | ||
// const MotionTag = onClick ? m.button : m.div | ||
|
||
return ( | ||
<MotionTag | ||
layoutId={id} | ||
layout="position" | ||
className={clsx( | ||
'relative w-full overflow-hidden rounded-xl shadow-md shadow-slate-200 dark:shadow-stone-800', | ||
'my-4 mr-4 px-4 py-5 pr-7', | ||
'bg-slate-50/90 backdrop-blur-sm dark:bg-neutral-900/90', | ||
'border border-slate-100/80 dark:border-neutral-900/80', | ||
'space-x-4', | ||
'flex items-center', | ||
'select-none', | ||
)} | ||
onClick={onClick} | ||
> | ||
{iconElement ?? typeMap[props.toastProps?.type ?? 'default']} | ||
<span>{message}</span> | ||
// return ( | ||
// <MotionTag | ||
// layoutId={id} | ||
// layout="position" | ||
// className={clsx( | ||
// 'relative w-full overflow-hidden rounded-xl shadow-md shadow-slate-200 dark:shadow-stone-800', | ||
// 'my-4 mr-4 px-4 py-5 pr-7', | ||
// 'bg-slate-50/90 backdrop-blur-sm dark:bg-neutral-900/90', | ||
// 'border border-slate-100/80 dark:border-neutral-900/80', | ||
// 'space-x-4', | ||
// 'flex items-center', | ||
// 'select-none', | ||
// )} | ||
// onClick={onClick} | ||
// > | ||
// {iconElement ?? typeMap[props.toastProps?.type ?? 'default']} | ||
// <span>{message}</span> | ||
|
||
<MotionButtonBase | ||
aria-label="Close toast" | ||
className="absolute bottom-0 right-3 top-0 flex items-center text-sm text-base-content/40 duration-200 hover:text-base-content/80" | ||
onClick={(e) => { | ||
e.stopPropagation() | ||
closeToast?.() | ||
}} | ||
> | ||
<i className="icon-[mingcute--close-fill] p-2" /> | ||
</MotionButtonBase> | ||
</MotionTag> | ||
) | ||
} | ||
// <MotionButtonBase | ||
// aria-label="Close toast" | ||
// className="absolute bottom-0 right-3 top-0 flex items-center text-sm text-base-content/40 duration-200 hover:text-base-content/80" | ||
// onClick={(e) => { | ||
// e.stopPropagation() | ||
// closeToast?.() | ||
// }} | ||
// > | ||
// <i className="icon-[mingcute--close-fill] p-2" /> | ||
// </MotionButtonBase> | ||
// </MotionTag> | ||
// ) | ||
// } | ||
export {} |
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.
fb72500
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
shiro – ./
springtide.vercel.app
shiro-innei.vercel.app
innei.in
shiro-git-main-innei.vercel.app