From cfe4731ded7e0360e819f52925f07e566c694e7d Mon Sep 17 00:00:00 2001 From: muerwre Date: Tue, 6 Aug 2019 21:10:09 +0700 Subject: [PATCH] dialog close button --- src/containers/dialogs/EditorDialog/index.tsx | 2 +- src/containers/dialogs/ScrollDialog/index.tsx | 13 ++++-- .../dialogs/ScrollDialog/styles.scss | 46 ++++++++++++++++++- 3 files changed, 55 insertions(+), 6 deletions(-) diff --git a/src/containers/dialogs/EditorDialog/index.tsx b/src/containers/dialogs/EditorDialog/index.tsx index 3725fee7..db059871 100644 --- a/src/containers/dialogs/EditorDialog/index.tsx +++ b/src/containers/dialogs/EditorDialog/index.tsx @@ -41,7 +41,7 @@ const EditorDialogUnconnected: FC = ({ onRequestClose, editor }) => { useCloseOnEscape(onRequestClose); return ( - +
; - onRefCapture?: (ref: any) => void; error?: string; top_sticky?: ReactChild; top_sticky_offset?: number; + + onOverlayClick?: MouseEventHandler; + onRefCapture?: (ref: any) => void; + onClose?: () => void; } const ScrollDialog: FC = ({ @@ -27,7 +29,8 @@ const ScrollDialog: FC = ({ top_sticky_offset, error, onOverlayClick, - onRefCapture + onRefCapture, + onClose, }) => { const [height, setHeight] = useState(window.innerHeight - 120); const [show_top_sticky, setShowTopSticky] = useState(false); @@ -74,6 +77,8 @@ const ScrollDialog: FC = ({ {!!title && (
+ { onClose &&
} +
{title} {show_top_sticky && top_sticky && ( @@ -87,6 +92,8 @@ const ScrollDialog: FC = ({ {!title && (
+ { onClose &&
} +
diff --git a/src/containers/dialogs/ScrollDialog/styles.scss b/src/containers/dialogs/ScrollDialog/styles.scss index a30be9da..5de3f7f1 100644 --- a/src/containers/dialogs/ScrollDialog/styles.scss +++ b/src/containers/dialogs/ScrollDialog/styles.scss @@ -20,7 +20,7 @@ align-items: center; justify-content: center; position: relative; - padding: 10px 0 0 0; + padding: 40px 0 0 0; box-sizing: border-box; flex: 1 1 800px; z-index: 1; @@ -51,7 +51,7 @@ } .top { - height: 10px; + height: 40px; top: 0; &:global(.has_buttons) { @@ -155,3 +155,45 @@ opacity: 1; } } + +@keyframes spin_1 { + 0% { transform: rotate(0); } + 100% { transform: rotate(45deg); } +} + +@keyframes spin_2 { + 0% { transform: rotate(0); } + 100% { transform: rotate(-45deg); } +} + +.close { + width: 32px; + height: 32px; + position: absolute; + bottom: 20px; + left: 50%; + transform: translate(-50%, 0); + cursor: pointer; + opacity: 0.5; + transition: opacity 0.5s, transform 0.25s; + + &:hover { + opacity: 1; + transform: translate(-50%, -4px); + } + + &::before, &::after { + content: ' '; + width: 32px; + height: 2px; + background: white; + position: absolute; + top: 50%; + left: 0; + animation: spin_1 0.5s forwards; + } + + &::before { + animation: spin_2 0.5s forwards; + } +}