diff --git a/app/features/hidden-list-component.tsx b/app/features/hidden-list-component.tsx index 43ec56d..4160e4f 100644 --- a/app/features/hidden-list-component.tsx +++ b/app/features/hidden-list-component.tsx @@ -1,11 +1,12 @@ import clsx from 'clsx' import { useState } from 'react' -import { Arrow, DeleteIcon, EditIcon } from 'assets/icons' +import { DeleteIcon, EditIcon } from 'assets/icons' import { useDispatch } from 'react-redux' -import { ThunkDispatch } from '@reduxjs/toolkit' -import toast, { Toaster } from 'react-hot-toast' +import type { ThunkDispatch } from '@reduxjs/toolkit' +import toast from 'react-hot-toast' import { removeBlock } from '~/redux/slices/course' import { delay } from '~/widgets/helpers/delay' +import { ToasterWithOptions } from '~/shared' interface Props { header: string @@ -88,23 +89,7 @@ export function HiddenListComponent({ header, index, className, id }: Props) {

- + ) } diff --git a/app/routes/edit-course.$course.tsx b/app/routes/edit-course.$course.tsx index de6697d..e325224 100644 --- a/app/routes/edit-course.$course.tsx +++ b/app/routes/edit-course.$course.tsx @@ -3,13 +3,12 @@ import { useParams } from '@remix-run/react' import { Spinner } from 'flowbite-react' import { useEffect, useState } from 'react' import { useForm } from 'react-hook-form' -import toast, { Toaster } from 'react-hot-toast' +import toast from 'react-hot-toast' import { useDispatch, useSelector } from 'react-redux' import { HiddenListComponent } from '~/features' import { fetchCourse, updateBlock } from '~/redux/slices/course' -import { Header2, Header3, Header4, TransparentButton } from '~/shared' +import { Header3, Header4, ToasterWithOptions, TransparentButton } from '~/shared' import { delay } from '~/widgets/helpers/delay' -// import { delay } from '~/widgets/helpers/delay' export default function Course() { const params = useParams() @@ -134,23 +133,7 @@ export default function Course() { )} - + ) } diff --git a/app/shared/Common/toaster-with-options.tsx b/app/shared/Common/toaster-with-options.tsx new file mode 100644 index 0000000..1214ec6 --- /dev/null +++ b/app/shared/Common/toaster-with-options.tsx @@ -0,0 +1,23 @@ +import { Toaster } from 'react-hot-toast' + +export function ToasterWithOptions() { + return ( + + ) +} diff --git a/app/shared/index.ts b/app/shared/index.ts index 66a626d..5b34b85 100644 --- a/app/shared/index.ts +++ b/app/shared/index.ts @@ -11,3 +11,4 @@ export * from './Typo/header-3' export * from './Typo/header-4' export * from './divider' export * from './tag' +export * from './Common/toaster-with-options' diff --git a/app/widgets/create-course-form.tsx b/app/widgets/create-course-form.tsx index 45835ab..6abf4ef 100644 --- a/app/widgets/create-course-form.tsx +++ b/app/widgets/create-course-form.tsx @@ -4,6 +4,7 @@ import { FilledButton, Header3, Text, + ToasterWithOptions, } from '~/shared' import clsx from 'clsx' import { useDispatch } from 'react-redux' @@ -11,7 +12,7 @@ import type { ThunkDispatch } from '@reduxjs/toolkit' import { useForm } from 'react-hook-form' import { objectToFormData } from './helpers/object-to-form-data' import { createCourse } from '~/redux/slices/courses' -import toast, { Toaster } from 'react-hot-toast' +import toast from 'react-hot-toast' import { delay } from './helpers/delay' import { useNavigate } from '@remix-run/react' @@ -302,23 +303,7 @@ export function CreateCourseForm() {

Створити

- + ) } diff --git a/app/widgets/login-card.tsx b/app/widgets/login-card.tsx index 2e932de..f64b3b8 100644 --- a/app/widgets/login-card.tsx +++ b/app/widgets/login-card.tsx @@ -1,10 +1,10 @@ import type { ThunkDispatch } from '@reduxjs/toolkit' import { Link, useNavigate } from '@remix-run/react' import { useForm } from 'react-hook-form' -import toast, { Toaster } from 'react-hot-toast' +import toast from 'react-hot-toast' import { useDispatch } from 'react-redux' import { fetchAuth } from '~/redux/slices/auth' -import { Text, FilledButton } from '~/shared' +import { Text, FilledButton, ToasterWithOptions } from '~/shared' import { delay } from './helpers/delay' export default function LoginCard() { @@ -90,23 +90,7 @@ export default function LoginCard() { - + ) } diff --git a/app/widgets/register-card.tsx b/app/widgets/register-card.tsx index 3e86a4c..f4360f7 100644 --- a/app/widgets/register-card.tsx +++ b/app/widgets/register-card.tsx @@ -1,10 +1,10 @@ -import { Text, FilledButton } from '~/shared' +import { Text, FilledButton, ToasterWithOptions } from '~/shared' import { useForm } from 'react-hook-form' import { useDispatch } from 'react-redux' import { fetchRegister } from '~/redux/slices/auth' import type { ThunkDispatch } from '@reduxjs/toolkit' import { useNavigate } from '@remix-run/react' -import toast, { Toaster } from 'react-hot-toast' +import toast from 'react-hot-toast' import { delay } from './helpers/delay' export default function RegisterCard() { @@ -105,23 +105,8 @@ export default function RegisterCard() {

Зареєструвати

- + + ) }