feat: first commit
This commit is contained in:
32
src/components/common-dialog/index.less
Normal file
32
src/components/common-dialog/index.less
Normal file
@ -0,0 +1,32 @@
|
||||
@import '@/styles/common.less';
|
||||
@import '@/styles/variables.less';
|
||||
|
||||
.common-dialog {
|
||||
&__container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
&__title {
|
||||
font-size: 36px;
|
||||
line-height: 58px;
|
||||
font-weight: 500;
|
||||
color: @blColor;
|
||||
}
|
||||
|
||||
&__confirm-button,
|
||||
&__cancel-button {
|
||||
.button(@width: 360px, @height: 72px, @fontSize: 28px, @fontWeight: 400, @borderRadius: 44px);
|
||||
}
|
||||
|
||||
&__confirm-button {
|
||||
margin-top: 48px;
|
||||
}
|
||||
|
||||
&__cancel-button {
|
||||
color: @blHighlightColor;
|
||||
background: transparent;
|
||||
margin-top: 40px;
|
||||
}
|
||||
}
|
||||
47
src/components/common-dialog/index.tsx
Normal file
47
src/components/common-dialog/index.tsx
Normal file
@ -0,0 +1,47 @@
|
||||
import { Button } from '@tarojs/components';
|
||||
|
||||
import { Dialog } from '@taroify/core';
|
||||
import classNames from 'classnames';
|
||||
import { PropsWithChildren } from 'react';
|
||||
|
||||
import './index.less';
|
||||
|
||||
interface IProps extends PropsWithChildren {
|
||||
visible: boolean;
|
||||
content: string;
|
||||
onClose?: () => void;
|
||||
className?: string;
|
||||
confirm?: string;
|
||||
cancel?: string;
|
||||
onClick?: () => void;
|
||||
onCancel?: () => void;
|
||||
}
|
||||
|
||||
const PREFIX = 'common-dialog';
|
||||
|
||||
function CommonDialog(props: IProps) {
|
||||
const { visible, content, confirm, cancel, className, children, onClose, onClick, onCancel } = props;
|
||||
|
||||
return (
|
||||
<Dialog className={classNames(PREFIX, className)} open={visible} onClose={onClose}>
|
||||
<Dialog.Content>
|
||||
<div className={`${PREFIX}__container`}>
|
||||
<div className={`${PREFIX}__title`}>{content}</div>
|
||||
{children}
|
||||
{confirm && (
|
||||
<Button className={`${PREFIX}__confirm-button`} onClick={onClick}>
|
||||
{confirm}
|
||||
</Button>
|
||||
)}
|
||||
{cancel && (
|
||||
<Button className={`${PREFIX}__cancel-button`} onClick={onCancel}>
|
||||
{cancel}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
</Dialog.Content>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export default CommonDialog;
|
||||
Reference in New Issue
Block a user