From 1e01ed0b0fc771d47135656a1ecd305b43517528 Mon Sep 17 00:00:00 2001 From: Peng Xiao Date: Tue, 5 Dec 2023 09:18:49 +0000 Subject: [PATCH] fix(component): modal blurness (#5177) moved https://github.com/toeverything/design/pull/108 Do not use transform to center the modal. It has know issue to cause modal to have blurred texts. https://github.com/radix-ui/website/issues/383 fix https://github.com/toeverything/AFFiNE/issues/5176 --- .../frontend/component/src/ui/modal/modal.tsx | 74 ++++++++++--------- .../component/src/ui/modal/styles.css.ts | 15 ++-- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/packages/frontend/component/src/ui/modal/modal.tsx b/packages/frontend/component/src/ui/modal/modal.tsx index d34de8e6e7..bf14329fce 100644 --- a/packages/frontend/component/src/ui/modal/modal.tsx +++ b/packages/frontend/component/src/ui/modal/modal.tsx @@ -67,42 +67,46 @@ export const Modal = forwardRef( className={clsx(styles.modalOverlay, overlayClassName)} {...otherOverlayOptions} /> - - {withoutCloseButton ? null : ( - - - - - - )} - {title ? ( - {title} - ) : null} - {description ? ( - - {description} - - ) : null} +
+ + {withoutCloseButton ? null : ( + + + + + + )} + {title ? ( + + {title} + + ) : null} + {description ? ( + + {description} + + ) : null} - {children} - + {children} + +
) diff --git a/packages/frontend/component/src/ui/modal/styles.css.ts b/packages/frontend/component/src/ui/modal/styles.css.ts index f5e6ef18ec..116e9c1021 100644 --- a/packages/frontend/component/src/ui/modal/styles.css.ts +++ b/packages/frontend/component/src/ui/modal/styles.css.ts @@ -11,6 +11,15 @@ export const modalOverlay = style({ zIndex: 'var(--affine-z-index-modal)', }); +export const modalContentWrapper = style({ + position: 'fixed', + inset: 0, + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + zIndex: 'var(--affine-z-index-modal)', +}); + export const modalContent = style({ vars: { [widthVar]: '', @@ -25,17 +34,13 @@ export const modalContent = style({ fontWeight: '400', lineHeight: '1.6', padding: '20px 24px', + position: 'relative', backgroundColor: 'var(--affine-background-overlay-panel-color)', boxShadow: 'var(--affine-popover-shadow)', borderRadius: '12px', maxHeight: 'calc(100vh - 32px)', // :focus-visible will set outline outline: 'none', - position: 'fixed', - zIndex: 'var(--affine-z-index-modal)', - top: ' 50%', - left: '50%', - transform: 'translate(-50%, -50%)', }); export const closeButton = style({