MSP-3134 move folders
This commit is contained in:
1 parent
ab902d855e
commit
ec02fb7af0
7 files changed
+91
-73
No files matched your search
@@ -1,22 +0,0 @@
|
||||
import {Button} from "antd";
|
||||
import './close-btn.scss'
|
||||
interface CloseBtnPropsType {
|
||||
ariaLabel?: string
|
||||
onClick: () => void
|
||||
}
|
||||
const CloseBtn = ({onClick, ariaLabel}: CloseBtnPropsType) => {
|
||||
return (
|
||||
<Button
|
||||
className="close-btn"
|
||||
aria-label={ariaLabel}
|
||||
onClick={onClick}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="20px" height="20px">
|
||||
<path
|
||||
d="M 7.71875 6.28125 L 6.28125 7.71875 L 23.5625 25 L 6.28125 42.28125 L 7.71875 43.71875 L 25 26.4375 L 42.28125 43.71875 L 43.71875 42.28125 L 26.4375 25 L 43.71875 7.71875 L 42.28125 6.28125 L 25 23.5625 Z"/>
|
||||
</svg>
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
||||
export default CloseBtn;
|
||||
@@ -1,43 +0,0 @@
|
||||
import {Dispatch, MouseEvent, ReactNode, SetStateAction } from "react";
|
||||
import {Button} from "antd";
|
||||
import CloseBtn from "@components/CloseBtn";
|
||||
import './modal.scss';
|
||||
|
||||
interface ModalPropsType {
|
||||
onOk?: () => void
|
||||
title: string
|
||||
children: ReactNode
|
||||
setIsOpenModal: Dispatch<SetStateAction<boolean>>
|
||||
footer?: {onOkText: string, onCanselText: string}
|
||||
}
|
||||
|
||||
const Modal = ({ onOk, footer, title, children, setIsOpenModal }: ModalPropsType) => {
|
||||
const closeModal = () => {
|
||||
setIsOpenModal(false);
|
||||
};
|
||||
|
||||
const handleModalClick = (event: MouseEvent<HTMLDivElement>) => {
|
||||
event.stopPropagation();
|
||||
};
|
||||
|
||||
return (
|
||||
<section className="modal" onClick={closeModal}>
|
||||
<div className="modal__wrap" onClick={handleModalClick}>
|
||||
<h1 className="modal__title">{title}</h1>
|
||||
<div className="modal__content">
|
||||
{children}
|
||||
</div>
|
||||
{footer &&
|
||||
<div className="modal__footer">
|
||||
<Button type="default" onClick={closeModal}>{footer.onCanselText}</Button>
|
||||
<Button type="default" onClick={onOk}>{footer.onOkText}</Button>
|
||||
</div>
|
||||
}
|
||||
<CloseBtn onClick={closeModal} ariaLabel="close"/>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export default Modal;
|
||||
@@ -1,17 +1,19 @@
|
||||
import {useState} from "react";
|
||||
import Modal from "src/widgets/Modal";
|
||||
import { Button, theme } from 'antd';
|
||||
import { useRole } from '@hooks/useRole.tsx';
|
||||
import { Button, theme } from 'antd'
|
||||
import { useState } from 'react'
|
||||
|
||||
import { useRole } from '@hooks/useRole.tsx'
|
||||
|
||||
import { PermissionKeys } from '@type/roles.type.ts'
|
||||
|
||||
import './home.scss'
|
||||
import Modal from 'src/widgets/Modal'
|
||||
|
||||
import './home-page.scss'
|
||||
|
||||
const HomePages = () => {
|
||||
const { hasPermission } = useRole()
|
||||
const { useToken } = theme
|
||||
const { token } = useToken()
|
||||
const [isOpenModal, setIsOpenModal] = useState(false)
|
||||
const [isOpenModal, setIsOpenModal] = useState(false)
|
||||
|
||||
const isPageAvailable = hasPermission(PermissionKeys.user_view)
|
||||
|
||||
@@ -24,9 +26,15 @@ const HomePages = () => {
|
||||
)}
|
||||
<div>Проверка шрифтов</div>
|
||||
|
||||
{isOpenModal && <Modal setIsOpenModal={setIsOpenModal} title="modal title"><div>modal content</div></Modal>}
|
||||
{isOpenModal && (
|
||||
<Modal setIsOpenModal={setIsOpenModal} title="modal title">
|
||||
<div>modal content</div>
|
||||
</Modal>
|
||||
)}
|
||||
|
||||
<Button type="primary" onClick={() => setIsOpenModal(true)}>Open Modal</Button>
|
||||
<Button type="primary" onClick={() => setIsOpenModal(true)}>
|
||||
Open Modal
|
||||
</Button>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
|
||||
File renamed without changes.
@@ -0,0 +1,24 @@
|
||||
import { Button } from 'antd'
|
||||
|
||||
import './close-btn.scss'
|
||||
|
||||
interface CloseBtnPropsType {
|
||||
ariaLabel?: string
|
||||
onClick: () => void
|
||||
}
|
||||
const CloseBtn = ({ onClick, ariaLabel }: CloseBtnPropsType) => {
|
||||
return (
|
||||
<Button className="close-btn" aria-label={ariaLabel} onClick={onClick}>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 50 50"
|
||||
width="20px"
|
||||
height="20px"
|
||||
>
|
||||
<path d="M 7.71875 6.28125 L 6.28125 7.71875 L 23.5625 25 L 6.28125 42.28125 L 7.71875 43.71875 L 25 26.4375 L 42.28125 43.71875 L 43.71875 42.28125 L 26.4375 25 L 43.71875 7.71875 L 42.28125 6.28125 L 25 23.5625 Z" />
|
||||
</svg>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export default CloseBtn
|
||||
@@ -0,0 +1,51 @@
|
||||
import { Button } from 'antd'
|
||||
import { Dispatch, MouseEvent, ReactNode, SetStateAction } from 'react'
|
||||
import CloseBtn from 'src/ui/CloseBtn'
|
||||
|
||||
import './modal.scss'
|
||||
|
||||
interface ModalPropsType {
|
||||
onOk?: () => void
|
||||
title: string
|
||||
children: ReactNode
|
||||
setIsOpenModal: Dispatch<SetStateAction<boolean>>
|
||||
footer?: { onOkText: string; onCanselText: string }
|
||||
}
|
||||
|
||||
const Modal = ({
|
||||
onOk,
|
||||
footer,
|
||||
title,
|
||||
children,
|
||||
setIsOpenModal
|
||||
}: ModalPropsType) => {
|
||||
const closeModal = () => {
|
||||
setIsOpenModal(false)
|
||||
}
|
||||
|
||||
const handleModalClick = (event: MouseEvent<HTMLDivElement>) => {
|
||||
event.stopPropagation()
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="modal" onClick={closeModal}>
|
||||
<div className="modal__wrap" onClick={handleModalClick}>
|
||||
<h1 className="modal__title">{title}</h1>
|
||||
<div className="modal__content">{children}</div>
|
||||
{footer && (
|
||||
<div className="modal__footer">
|
||||
<Button type="default" onClick={closeModal}>
|
||||
{footer.onCanselText}
|
||||
</Button>
|
||||
<Button type="default" onClick={onOk}>
|
||||
{footer.onOkText}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<CloseBtn onClick={closeModal} ariaLabel="close" />
|
||||
</div>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export default Modal
|
||||
File renamed without changes.
Reference in new issue
Block a user