From 69b396b9d4e88e35316bdad00f9f09a662245df0 Mon Sep 17 00:00:00 2001 From: JimmFly Date: Wed, 18 Jan 2023 15:54:56 +0800 Subject: [PATCH] chore: update confirm ui component --- packages/app/src/ui/confirm/Confirm.tsx | 87 +++++++++++++++++-------- packages/app/src/ui/confirm/styles.ts | 18 ++++- 2 files changed, 76 insertions(+), 29 deletions(-) diff --git a/packages/app/src/ui/confirm/Confirm.tsx b/packages/app/src/ui/confirm/Confirm.tsx index 1c22e16021..27bf8579e0 100644 --- a/packages/app/src/ui/confirm/Confirm.tsx +++ b/packages/app/src/ui/confirm/Confirm.tsx @@ -1,7 +1,8 @@ import { useState } from 'react'; import { Modal, ModalCloseButton, ModalProps } from '../modal'; import { - StyledButtonWrapper, + StyledRowButtonWrapper, + StyledColumnButtonWrapper, StyledConfirmContent, StyledConfirmTitle, StyledModalWrapper, @@ -15,6 +16,7 @@ export type ConfirmProps = { cancelText?: string; // TODO: Confirm button's color should depend on confirm type confirmType?: 'primary' | 'warning' | 'danger'; + buttonDirection?: 'row' | 'column'; onConfirm?: () => void; onCancel?: () => void; } & Omit; @@ -26,6 +28,7 @@ export const Confirm = ({ confirmType, onConfirm, onCancel, + buttonDirection = 'row', cancelText = 'Cancel', }: ConfirmProps) => { const [open, setOpen] = useState(true); @@ -41,31 +44,63 @@ export const Confirm = ({ /> {title} {content} - - - - - + {buttonDirection === 'row' ? ( + + + + + ) : ( + + + + + )} ); diff --git a/packages/app/src/ui/confirm/styles.ts b/packages/app/src/ui/confirm/styles.ts index ef2c86155d..3646cdcc38 100644 --- a/packages/app/src/ui/confirm/styles.ts +++ b/packages/app/src/ui/confirm/styles.ts @@ -3,8 +3,10 @@ import { ModalWrapper } from '@/ui/modal'; export const StyledModalWrapper = styled(ModalWrapper)(() => { return { - width: '460px', - padding: '46px 60px 32px', + minWidth: '460px', + maxWidth: '560px', + maxHeight: '292px', + padding: '44px 84px 32px 84px', }; }); @@ -14,6 +16,7 @@ export const StyledConfirmTitle = styled.div(({ theme }) => { fontWeight: 600, textAlign: 'center', color: theme.colors.popoverColor, + lineHeight: '28px', }; }); @@ -23,12 +26,21 @@ export const StyledConfirmContent = styled.div(({ theme }) => { textAlign: 'center', marginTop: '12px', color: theme.colors.textColor, + lineHeight: '26px', }; }); -export const StyledButtonWrapper = styled.div(() => { +export const StyledColumnButtonWrapper = styled.div(() => { return { ...displayFlex('center', 'center'), + flexDirection: 'column', + marginTop: '32px', + }; +}); +export const StyledRowButtonWrapper = styled.div(() => { + return { + ...displayFlex('center', 'center'), + flexDirection: 'row', marginTop: '32px', }; });