Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
wilfred committed Jan 29, 2024
1 parent 61263f4 commit 329e5d2
Show file tree
Hide file tree
Showing 11 changed files with 502 additions and 392 deletions.
38 changes: 19 additions & 19 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import '@/styles/index.scss';

import { Metadata, Viewport } from 'next';

import StoreProvider from '@/Providers/StoreProvider';
import { UnisatProvider } from '@/Providers/unisat-context';
import { UserProvider } from '@/Providers/user-context';
import { XVerseProvider } from '@/Providers/xverse-context';
import Hydrated from '@/components/Hydrated';
import ToastOverlay from '@/components/ToastOverlay';
import { MetadataConfig, ViewportConfig } from '@/config';
import chakraThemes from '@/themes/chakra-themes';
import { ChakraProvider } from '@chakra-ui/react';
import Hydrated from '@/components/Hydrated';
import dynamic from 'next/dynamic';
import StoreProvider from '@/Providers/StoreProvider';
import { XVerseProvider } from '@/Providers/xverse-context';
import { UnisatProvider } from '@/Providers/unisat-context';
import ToastOverlay from '@/components/ToastOverlay';
import { UserProvider } from '@/Providers/user-context';

export const metadata: Metadata = MetadataConfig;
export const viewport: Viewport = ViewportConfig;
Expand All @@ -31,19 +31,19 @@ export default function RootLayout({
return (
<html lang="en">
<body>
<StoreProvider>
<ChakraProvider theme={chakraThemes}>
<ChakraFontsFace />
<UserProvider>
<XVerseProvider>
<UnisatProvider>
<Hydrated>{children}</Hydrated>
<ToastOverlay />
</UnisatProvider>
</XVerseProvider>
</UserProvider>
</ChakraProvider>
</StoreProvider>
<StoreProvider>
<ChakraProvider theme={chakraThemes}>
<ChakraFontsFace />
<UserProvider>
<XVerseProvider>
<UnisatProvider>
<Hydrated>{children}</Hydrated>
<ToastOverlay />
</UnisatProvider>
</XVerseProvider>
</UserProvider>
</ChakraProvider>
</StoreProvider>
</body>
</html>
);
Expand Down
76 changes: 37 additions & 39 deletions src/components/BaseModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import s from './styles.module.scss';
import React, { PropsWithChildren } from 'react';
import cs from 'classnames';
import { CDN_URL_ICONS } from '@/config';
import { Modal, ModalHeader, ModalBody, ModalOverlay, ModalContent } from '@chakra-ui/modal';
import { Flex } from '@chakra-ui/react';
import { size } from 'valibot';
import SvgInset from '@/components/SvgInset';
import {
Modal,
ModalBody,
ModalContent,
ModalHeader,
ModalOverlay,
} from '@chakra-ui/modal';
import { Flex } from '@chakra-ui/react';
import cs from 'classnames';
import React, { PropsWithChildren } from 'react';
import s from './styles.module.scss';

export interface IBaseModalProps {
isShow: boolean;
Expand All @@ -17,7 +21,9 @@ export interface IBaseModalProps {
headerClassName?: string;
}

const BaseModal = (props: PropsWithChildren<IBaseModalProps>): React.ReactNode => {
const BaseModal = (
props: PropsWithChildren<IBaseModalProps>,
): React.ReactNode => {
const {
isShow,
onHide,
Expand All @@ -26,40 +32,32 @@ const BaseModal = (props: PropsWithChildren<IBaseModalProps>): React.ReactNode =
children,
description,
headerClassName,
size = "normal"
size = 'normal',
} = props;

return (
<Modal
isOpen={isShow}
onClose={onHide}
isCentered={true}
>
<ModalOverlay />
<ModalContent className={cs(s.modalContent, s[size], className)}>
<ModalHeader className={cs(s.modalHeader, headerClassName)}>
<Flex justifyContent="space-between" alignItems="center">
<button
onClick={onHide}
className={s.modalHeader_closeBtn}
>
<SvgInset className={s.closeIcon} svgUrl={`/icons/ic_close_modal.svg`} />
</button>
<p className={s.modalHeader_title}>
{title}
</p>
</Flex>
</ModalHeader>
<ModalBody>
{!!description && (
<p className={s.modalHeader_description} >
{description}
</p>
)}
{children}
</ModalBody>
</ModalContent>
</Modal>
<Modal isOpen={isShow} onClose={onHide} isCentered={true}>
<ModalOverlay />
<ModalContent className={cs(s.modalContent, s[size], className)}>
<ModalHeader className={cs(s.modalHeader, headerClassName)}>
<Flex justifyContent="space-between" alignItems="center">
<button onClick={onHide} className={s.modalHeader_closeBtn}>
<SvgInset
className={s.closeIcon}
svgUrl={`/icons/ic_close_modal.svg`}
/>
</button>
<p className={s.modalHeader_title}>{title}</p>
</Flex>
</ModalHeader>
<ModalBody>
{!!description && (
<p className={s.modalHeader_description}>{description}</p>
)}
{children}
</ModalBody>
</ModalContent>
</Modal>
);
};

Expand Down
Loading

0 comments on commit 329e5d2

Please sign in to comment.