From a5e44cf4780a7bba55e33653357c41dffdb6521b Mon Sep 17 00:00:00 2001 From: simeng-li Date: Fri, 1 Jul 2022 10:07:43 +0800 Subject: [PATCH] style(ui): add dark mode social icon (#1265) * style(ui): add dark mode social icon add dark mode social icon * style(ui): social landing icon social landing icon * fix(ui): dark connector icon cr update dark connector icon cr update * fix(ui): cr fix cr fix --- .../Button/SocialIconButton.module.scss | 11 +++---- .../components/Button/SocialIconButton.tsx | 26 +++++++++------- .../components/Button/SocialLinkButton.tsx | 15 ++++------ .../ui/src/components/Button/index.test.tsx | 7 ++++- .../ui/src/containers/SocialLanding/index.tsx | 8 +++-- .../SocialSignInDropdown/index.tsx | 10 +++++-- .../SocialSignInIconList/index.tsx | 28 ++++++++++------- .../SocialSignIn/SocialSignInList/index.tsx | 30 +++++++++++-------- packages/ui/src/hooks/use-social.ts | 3 +- packages/ui/src/utils/social-connectors.ts | 2 ++ 10 files changed, 85 insertions(+), 55 deletions(-) diff --git a/packages/ui/src/components/Button/SocialIconButton.module.scss b/packages/ui/src/components/Button/SocialIconButton.module.scss index 029f14d97..36d5dc538 100644 --- a/packages/ui/src/components/Button/SocialIconButton.module.scss +++ b/packages/ui/src/components/Button/SocialIconButton.module.scss @@ -1,6 +1,5 @@ @use '@/scss/underscore' as _; - .socialButton { border-radius: 50%; @include _.flex-column; @@ -9,6 +8,10 @@ width: 40px; height: 40px; cursor: pointer; + + &.inverse { + background: #fff; + } } .icon { @@ -20,13 +23,11 @@ :global(body.desktop) { .socialButton { - background: var(--color-layer); - - &:active { + &:not(.inverse):active { background: var(--color-pressed); } - &:hover:not(:active) { + &:not(.inverse):hover:not(:active) { background: var(--color-hover); } } diff --git a/packages/ui/src/components/Button/SocialIconButton.tsx b/packages/ui/src/components/Button/SocialIconButton.tsx index 1c49d728f..580bec094 100644 --- a/packages/ui/src/components/Button/SocialIconButton.tsx +++ b/packages/ui/src/components/Button/SocialIconButton.tsx @@ -1,24 +1,28 @@ import classNames from 'classnames'; import React from 'react'; -import { ConnectorData } from '@/types'; +import { isAppleConnector } from '@/utils/social-connectors'; import * as styles from './SocialIconButton.module.scss'; type Props = { className?: string; - connector: ConnectorData; + logo: string; + target?: string; onClick?: () => void; }; -const SocialIconButton = ({ className, connector, onClick }: Props) => { - const { target, logo } = connector; - - return ( - - ); -}; +const SocialIconButton = ({ className, logo, target, onClick }: Props) => ( + +); export default SocialIconButton; diff --git a/packages/ui/src/components/Button/SocialLinkButton.tsx b/packages/ui/src/components/Button/SocialLinkButton.tsx index 28cbba94b..c7af6963b 100644 --- a/packages/ui/src/components/Button/SocialLinkButton.tsx +++ b/packages/ui/src/components/Button/SocialLinkButton.tsx @@ -2,28 +2,25 @@ import classNames from 'classnames'; import React from 'react'; import { useTranslation } from 'react-i18next'; -import { ConnectorData } from '@/types'; - import * as socialLinkButtonStyles from './SocialLinkButton.module.scss'; import * as styles from './index.module.scss'; export type Props = { isDisabled?: boolean; className?: string; - connector: ConnectorData; + target: string; + logo: string; + name: Record; onClick?: () => void; }; -const SocialLinkButton = ({ isDisabled, className, connector, onClick }: Props) => { - const { target, name, logo } = connector; - +const SocialLinkButton = ({ isDisabled, className, target, name, logo, onClick }: Props) => { const { t, i18n: { language }, } = useTranslation(); - // TODO: LOG-2393 should fix name[locale] syntax error - const foundName = Object.entries(name).find(([lang]) => lang === language); - const localName = foundName ? foundName[1] : name.en; + + const localName = name[language] ?? target; return (