From 9b6fd4c417f2ee53375e436c839b711c86403d58 Mon Sep 17 00:00:00 2001 From: Wang Sijie Date: Fri, 24 Jun 2022 11:29:57 +0800 Subject: [PATCH] feat(console): add mobile web tab in preview (#1214) --- .../components/Preview.module.scss | 8 ------ .../SignInExperience/components/Preview.tsx | 28 ++++++++++++------- packages/phrases/src/locales/en.ts | 4 +-- packages/phrases/src/locales/zh-cn.ts | 6 ++-- packages/ui/src/hooks/use-preview.ts | 9 ++++-- .../ui/src/utils/social-connectors.test.ts | 10 ++++--- packages/ui/src/utils/social-connectors.ts | 8 ++++-- 7 files changed, 41 insertions(+), 32 deletions(-) diff --git a/packages/console/src/pages/SignInExperience/components/Preview.module.scss b/packages/console/src/pages/SignInExperience/components/Preview.module.scss index 0fd103e00..b358aca85 100644 --- a/packages/console/src/pages/SignInExperience/components/Preview.module.scss +++ b/packages/console/src/pages/SignInExperience/components/Preview.module.scss @@ -121,14 +121,6 @@ transform: scale(0.75); height: 675px; } - - .description { - margin-top: _.unit(6); - width: 100%; - text-align: center; - color: var(--color-caption); - font: var(--font-body-small); - } } } } diff --git a/packages/console/src/pages/SignInExperience/components/Preview.tsx b/packages/console/src/pages/SignInExperience/components/Preview.tsx index 80a2bf267..9308d80ab 100644 --- a/packages/console/src/pages/SignInExperience/components/Preview.tsx +++ b/packages/console/src/pages/SignInExperience/components/Preview.tsx @@ -23,7 +23,7 @@ const Preview = ({ signInExperience, className }: Props) => { const { t } = useTranslation(undefined, { keyPrefix: 'admin_console' }); const [language, setLanguage] = useState(Language.English); const [mode, setMode] = useState(AppearanceMode.LightMode); - const [platform, setPlatform] = useState<'web' | 'mobile'>('mobile'); + const [platform, setPlatform] = useState<'desktopWeb' | 'mobile' | 'mobileWeb'>('mobile'); const { data: allConnectors } = useSWR('/api/connectors'); const previewRef = useRef(null); @@ -93,7 +93,8 @@ const Preview = ({ signInExperience, className }: Props) => { }, language, mode, - platform, + platform: platform === 'desktopWeb' ? 'web' : 'mobile', + isNative: platform === 'mobile', }; }, [allConnectors, language, mode, platform, signInExperience]); @@ -157,18 +158,28 @@ const Preview = ({ signInExperience, className }: Props) => { {t('sign_in_exp.preview.mobile')} { - setPlatform('web'); + setPlatform('desktopWeb'); }} > - {t('sign_in_exp.preview.web')} + {t('sign_in_exp.preview.desktop_web')} + + { + setPlatform('mobileWeb'); + }} + > + {t('sign_in_exp.preview.mobile_web')} -
+
- {platform === 'mobile' && ( + {platform !== 'desktopWeb' && (
{dayjs().format('HH:mm')}
@@ -176,9 +187,6 @@ const Preview = ({ signInExperience, className }: Props) => { )}