From 243426882e5d51fc665ca0e5771da65537405db1 Mon Sep 17 00:00:00 2001 From: simeng-li Date: Thu, 19 May 2022 14:21:38 +0800 Subject: [PATCH] style(ui): web ui refinement (#879) * style(ui): web ui refinement web ui refinement * style(ui): shadow update shadow update --- .../components/AppContent/index.module.scss | 2 ++ .../components/Button/IconButton.module.scss | 30 +++++++++++++++++++ .../ui/src/components/Button/IconButton.tsx | 16 ++++++++++ .../src/components/ConfirmModal/AcModal.tsx | 5 +++- .../ConfirmModal/Acmodal.module.scss | 7 ++--- .../src/components/Drawer/index.module.scss | 2 +- packages/ui/src/components/Drawer/index.tsx | 5 +++- .../PrimarySocialSignIn.module.scss | 7 +++-- .../SocialSignIn/PrimarySocialSignIn.tsx | 7 +++-- .../SecondarySocialSignIn.module.scss | 9 ------ .../SocialSignIn/SecondarySocialSignIn.tsx | 7 +++-- .../ui/src/pages/SignIn/index.module.scss | 4 +++ packages/ui/src/scss/_desktop.scss | 5 ++-- packages/ui/src/scss/_mobile.scss | 2 +- 14 files changed, 81 insertions(+), 27 deletions(-) create mode 100644 packages/ui/src/components/Button/IconButton.module.scss create mode 100644 packages/ui/src/components/Button/IconButton.tsx diff --git a/packages/ui/src/components/AppContent/index.module.scss b/packages/ui/src/components/AppContent/index.module.scss index a88c36ad8..081610770 100644 --- a/packages/ui/src/components/AppContent/index.module.scss +++ b/packages/ui/src/components/AppContent/index.module.scss @@ -69,5 +69,7 @@ body { min-height: 640px; position: relative; padding: _.unit(6); + border-radius: var(--radius); + box-shadow: var(--shadow-3); } } diff --git a/packages/ui/src/components/Button/IconButton.module.scss b/packages/ui/src/components/Button/IconButton.module.scss new file mode 100644 index 000000000..520b368f2 --- /dev/null +++ b/packages/ui/src/components/Button/IconButton.module.scss @@ -0,0 +1,30 @@ +@use '@/scss/underscore' as _; + +.iconButton { + border: none; + outline: none; + background: none; + border-color: none; + border-radius: 6px; + transition: background 0.2s ease-in-out; + padding: _.unit(1); + @include _.flex-column; + cursor: pointer; + + > svg { + color: var(--color-icon); + } +} + + +:global(body.desktop) { + .iconButton { + &:active { + background: var(--color-pressed); + } + + &:hover:not(:active) { + background: var(--color-hover); + } + } +} diff --git a/packages/ui/src/components/Button/IconButton.tsx b/packages/ui/src/components/Button/IconButton.tsx new file mode 100644 index 000000000..6e26feb67 --- /dev/null +++ b/packages/ui/src/components/Button/IconButton.tsx @@ -0,0 +1,16 @@ +import classNames from 'classnames'; +import React, { HTMLProps, forwardRef, Ref } from 'react'; + +import * as styles from './IconButton.module.scss'; + +export type Props = Omit, 'type'>; + +const IconButton = ({ children, className, ...rest }: Props, ref: Ref) => { + return ( + + ); +}; + +export default forwardRef(IconButton); diff --git a/packages/ui/src/components/ConfirmModal/AcModal.tsx b/packages/ui/src/components/ConfirmModal/AcModal.tsx index 2e9e028d3..628ef8ce1 100644 --- a/packages/ui/src/components/ConfirmModal/AcModal.tsx +++ b/packages/ui/src/components/ConfirmModal/AcModal.tsx @@ -5,6 +5,7 @@ import ReactModal from 'react-modal'; import CloseIcon from '@/assets/icons/close-icon.svg'; import Button from '@/components/Button'; +import IconButton from '@/components/Button/IconButton'; import * as modalStyles from '../../scss/modal.module.scss'; import * as styles from './Acmodal.module.scss'; @@ -32,7 +33,9 @@ const AcModal = ({
{t('description.reminder')} - + + +
{children}
diff --git a/packages/ui/src/components/ConfirmModal/Acmodal.module.scss b/packages/ui/src/components/ConfirmModal/Acmodal.module.scss index b7c8f18d1..2512a8e9b 100644 --- a/packages/ui/src/components/ConfirmModal/Acmodal.module.scss +++ b/packages/ui/src/components/ConfirmModal/Acmodal.module.scss @@ -15,8 +15,8 @@ .container { background: var(--color-dialogue); - border-radius: var(--radius); border: _.border(var(--color-divider)); + border-radius: 16px; padding: _.unit(6); } @@ -27,8 +27,7 @@ justify-content: space-between; margin-bottom: _.unit(4); - > svg { - color: var(--color-icon); + svg { width: 24px; height: 24px; } @@ -49,6 +48,6 @@ } > button:first-child { - margin-right: _.unit(4); + margin-right: _.unit(3); } } diff --git a/packages/ui/src/components/Drawer/index.module.scss b/packages/ui/src/components/Drawer/index.module.scss index 29ba39dee..c0dc9c4f8 100644 --- a/packages/ui/src/components/Drawer/index.module.scss +++ b/packages/ui/src/components/Drawer/index.module.scss @@ -13,7 +13,7 @@ align-items: center; margin-bottom: _.unit(4); - > svg { + svg { color: var(--color-icon); width: 20px; height: 20px; diff --git a/packages/ui/src/components/Drawer/index.tsx b/packages/ui/src/components/Drawer/index.tsx index 61cf1077a..11fc183cc 100644 --- a/packages/ui/src/components/Drawer/index.tsx +++ b/packages/ui/src/components/Drawer/index.tsx @@ -5,6 +5,7 @@ import ReactModal from 'react-modal'; import CloseIcon from '@/assets/icons/close-icon.svg'; import * as modalStyles from '../../scss/modal.module.scss'; +import IconButton from '../Button/IconButton'; import * as styles from './index.module.scss'; type Props = { @@ -28,7 +29,9 @@ const Drawer = ({ className, isOpen = false, children, onClose }: Props) => { >
- + + +
{children}
diff --git a/packages/ui/src/containers/SocialSignIn/PrimarySocialSignIn.module.scss b/packages/ui/src/containers/SocialSignIn/PrimarySocialSignIn.module.scss index 0857b13dd..cce41edd4 100644 --- a/packages/ui/src/containers/SocialSignIn/PrimarySocialSignIn.module.scss +++ b/packages/ui/src/containers/SocialSignIn/PrimarySocialSignIn.module.scss @@ -9,9 +9,10 @@ } .expandIcon { - color: var(--color-icon); - width: 20px; - height: 20px; + > svg { + width: 20px; + height: 20px; + } &.expanded { transform: rotate(180deg); diff --git a/packages/ui/src/containers/SocialSignIn/PrimarySocialSignIn.tsx b/packages/ui/src/containers/SocialSignIn/PrimarySocialSignIn.tsx index ac4d0b779..07abbb00c 100644 --- a/packages/ui/src/containers/SocialSignIn/PrimarySocialSignIn.tsx +++ b/packages/ui/src/containers/SocialSignIn/PrimarySocialSignIn.tsx @@ -2,6 +2,7 @@ import classNames from 'classnames'; import React, { useState, useMemo } from 'react'; import ExpandIcon from '@/assets/icons/expand-icon.svg'; +import IconButton from '@/components/Button/IconButton'; import SocialLinkButton from '@/components/Button/SocialLinkButton'; import useSocial from '@/hooks/use-social'; @@ -42,12 +43,14 @@ const PrimarySocialSignIn = ({ className, isPopup = false, onSocialSignInCallbac /> ))} {!fullDisplay && ( - { setShowAll(!showAll); }} - /> + > + + )}
); diff --git a/packages/ui/src/containers/SocialSignIn/SecondarySocialSignIn.module.scss b/packages/ui/src/containers/SocialSignIn/SecondarySocialSignIn.module.scss index ed3da6d1b..0763d73e7 100644 --- a/packages/ui/src/containers/SocialSignIn/SecondarySocialSignIn.module.scss +++ b/packages/ui/src/containers/SocialSignIn/SecondarySocialSignIn.module.scss @@ -13,15 +13,6 @@ } } -.moreButton { - border-radius: 50%; - @include _.flex-column; - - > svg { - color: var(--color-icon); - } -} - :global(body.mobile) { .moreButton { > svg { diff --git a/packages/ui/src/containers/SocialSignIn/SecondarySocialSignIn.tsx b/packages/ui/src/containers/SocialSignIn/SecondarySocialSignIn.tsx index d4f01453b..97e133dec 100644 --- a/packages/ui/src/containers/SocialSignIn/SecondarySocialSignIn.tsx +++ b/packages/ui/src/containers/SocialSignIn/SecondarySocialSignIn.tsx @@ -2,6 +2,7 @@ import classNames from 'classnames'; import React, { useMemo, useState, useRef } from 'react'; import MoreSocialIcon from '@/assets/icons/more-social-icon.svg'; +import IconButton from '@/components/Button/IconButton'; import SocialIconButton from '@/components/Button/SocialIconButton'; import usePlatform from '@/hooks/use-platform'; import useSocial from '@/hooks/use-social'; @@ -20,7 +21,7 @@ const SecondarySocialSignIn = ({ className }: Props) => { const { socialConnectors, invokeSocialSignIn } = useSocial(); const isOverSize = socialConnectors.length > defaultSize; const [showModal, setShowModal] = useState(false); - const moreButtonRef = useRef(null); + const moreButtonRef = useRef(null); const { isMobile } = usePlatform(); const displayConnectors = useMemo(() => { @@ -45,7 +46,7 @@ const SecondarySocialSignIn = ({ className }: Props) => { /> ))} {isOverSize && ( - { @@ -53,7 +54,7 @@ const SecondarySocialSignIn = ({ className }: Props) => { }} > - + )}
{isOverSize && isMobile && ( diff --git a/packages/ui/src/pages/SignIn/index.module.scss b/packages/ui/src/pages/SignIn/index.module.scss index 78da71db6..5135485ac 100644 --- a/packages/ui/src/pages/SignIn/index.module.scss +++ b/packages/ui/src/pages/SignIn/index.module.scss @@ -52,6 +52,10 @@ margin-bottom: _.unit(12); } + .placeHolder { + flex: 0; + } + .divider { margin-bottom: _.unit(4); } diff --git a/packages/ui/src/scss/_desktop.scss b/packages/ui/src/scss/_desktop.scss index 36ba67112..4c34bc51e 100644 --- a/packages/ui/src/scss/_desktop.scss +++ b/packages/ui/src/scss/_desktop.scss @@ -35,7 +35,7 @@ $font-family: -apple-system, } @mixin colors-dark-theme { - --color-base: #25272b; + --color-base: #191c1d; --color-surface: #2a2c32; --color-text: #f7f8f8; --color-text-disabled: #5c5f60; @@ -65,7 +65,8 @@ $font-family: -apple-system, --color-toast: #34353f; --color-overlay: rgba(0, 0, 0, 30%); // shadows - --shadow-2: 0 2px 12px rgba(0, 0, 0, 12%); + --shadow-2: 0 4px 12px rgba(0, 0, 0, 12%); + --shadow-3: 0 4px 16px rgba(0, 0, 0, 20%); } @mixin fonts { diff --git a/packages/ui/src/scss/_mobile.scss b/packages/ui/src/scss/_mobile.scss index 3ce118b24..06c7fc40b 100644 --- a/packages/ui/src/scss/_mobile.scss +++ b/packages/ui/src/scss/_mobile.scss @@ -48,7 +48,7 @@ $font-family: -apple-system, --color-toast: #34353f; --color-overlay: rgba(0, 0, 0, 30%); // shadows - --shadow-2: 0 2px 12px rgba(0, 0, 0, 12%); + --shadow-2: 0 4px 12px rgba(0, 0, 0, 12%); } @mixin fonts {