From 49b7908fb88420603af201afbc9c9b7ccc0feaeb Mon Sep 17 00:00:00 2001 From: Wang Sijie Date: Thu, 26 May 2022 17:24:28 +0800 Subject: [PATCH] fix(console): preview mobile device color (#958) --- .../src/assets/images/phone-top-info.svg | 7 ---- packages/console/src/icons/PhoneInfo.tsx | 35 +++++++++++++++++++ .../components/Preview.module.scss | 19 +++++++++- .../SignInExperience/components/Preview.tsx | 6 ++-- 4 files changed, 56 insertions(+), 11 deletions(-) delete mode 100644 packages/console/src/assets/images/phone-top-info.svg create mode 100644 packages/console/src/icons/PhoneInfo.tsx diff --git a/packages/console/src/assets/images/phone-top-info.svg b/packages/console/src/assets/images/phone-top-info.svg deleted file mode 100644 index 0b2f0e012..000000000 --- a/packages/console/src/assets/images/phone-top-info.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/packages/console/src/icons/PhoneInfo.tsx b/packages/console/src/icons/PhoneInfo.tsx new file mode 100644 index 000000000..5c280c90d --- /dev/null +++ b/packages/console/src/icons/PhoneInfo.tsx @@ -0,0 +1,35 @@ +import React from 'react'; + +const PhoneInfo = () => ( + + + + + + + +); + +export default PhoneInfo; diff --git a/packages/console/src/pages/SignInExperience/components/Preview.module.scss b/packages/console/src/pages/SignInExperience/components/Preview.module.scss index 1220b9885..3f185e4e7 100644 --- a/packages/console/src/pages/SignInExperience/components/Preview.module.scss +++ b/packages/console/src/pages/SignInExperience/components/Preview.module.scss @@ -49,7 +49,6 @@ .device { width: 390px; margin: 0 auto; - background: var(--color-on-primary); border-radius: 26px; overflow: hidden; @@ -64,6 +63,24 @@ } } + &.dark { + // Sync with iframe's UI color + background: #1a1c1d; + + .topBar { + color: #fff; + } + } + + &.light { + // Sync with iframe's UI color + background: #fff; + + .topBar { + color: #000; + } + } + iframe { width: 390px; height: 808px; diff --git a/packages/console/src/pages/SignInExperience/components/Preview.tsx b/packages/console/src/pages/SignInExperience/components/Preview.tsx index 3e2fa4dd0..9ce15e31e 100644 --- a/packages/console/src/pages/SignInExperience/components/Preview.tsx +++ b/packages/console/src/pages/SignInExperience/components/Preview.tsx @@ -6,11 +6,11 @@ import React, { useEffect, useMemo, useState, useRef, useCallback } from 'react' import { useTranslation } from 'react-i18next'; import useSWR from 'swr'; -import TopInfoImage from '@/assets/images/phone-top-info.svg'; import Card from '@/components/Card'; import Select from '@/components/Select'; import TabNav, { TabNavItem } from '@/components/TabNav'; import { RequestError } from '@/hooks/use-api'; +import PhoneInfo from '@/icons/PhoneInfo'; import * as styles from './Preview.module.scss'; @@ -122,11 +122,11 @@ const Preview = ({ signInExperience, className }: Props) => {
-
+
{platform === 'mobile' && (
{dayjs().format('HH:mm')}
- +
)}