diff --git a/packages/console/src/components/TabNav/TabNavLink.module.scss b/packages/console/src/components/TabNav/TabNavItem.module.scss similarity index 94% rename from packages/console/src/components/TabNav/TabNavLink.module.scss rename to packages/console/src/components/TabNav/TabNavItem.module.scss index daf9022e1..199dbf45c 100644 --- a/packages/console/src/components/TabNav/TabNavLink.module.scss +++ b/packages/console/src/components/TabNav/TabNavItem.module.scss @@ -8,6 +8,7 @@ a { color: var(--color-caption); text-decoration: none; + cursor: pointer; } } diff --git a/packages/console/src/components/TabNav/TabNavItem.tsx b/packages/console/src/components/TabNav/TabNavItem.tsx new file mode 100644 index 000000000..12df27ab0 --- /dev/null +++ b/packages/console/src/components/TabNav/TabNavItem.tsx @@ -0,0 +1,25 @@ +import classNames from 'classnames'; +import React from 'react'; +import { Link, useLocation } from 'react-router-dom'; + +import * as styles from './TabNavItem.module.scss'; + +type Props = { + href?: string; + isActive?: boolean; + onClick?: () => void; + children: React.ReactNode; +}; + +const TabNavItem = ({ children, href, isActive, onClick }: Props) => { + const location = useLocation(); + const selected = href ? location.pathname === href : isActive; + + return ( +
+ {href ? {children} : {children}} +
+ ); +}; + +export default TabNavItem; diff --git a/packages/console/src/components/TabNav/TabNavLink.tsx b/packages/console/src/components/TabNav/TabNavLink.tsx deleted file mode 100644 index 8aa92a403..000000000 --- a/packages/console/src/components/TabNav/TabNavLink.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import classNames from 'classnames'; -import React from 'react'; -import { Link, useLocation } from 'react-router-dom'; - -import * as styles from './TabNavLink.module.scss'; - -type Props = { - href: string; - children: React.ReactNode; -}; - -const TabNavLink = ({ children, href }: Props) => { - const location = useLocation(); - const selected = location.pathname === href; - - return ( -
- {children} -
- ); -}; - -export default TabNavLink; diff --git a/packages/console/src/components/TabNav/index.tsx b/packages/console/src/components/TabNav/index.tsx index 673805253..ecc8c46c1 100644 --- a/packages/console/src/components/TabNav/index.tsx +++ b/packages/console/src/components/TabNav/index.tsx @@ -3,7 +3,7 @@ import React from 'react'; import * as styles from './index.module.scss'; -export { default as TabNavLink } from './TabNavLink'; +export { default as TabNavItem } from './TabNavItem'; type Props = { className?: string; diff --git a/packages/console/src/pages/ApiResourceDetails/index.tsx b/packages/console/src/pages/ApiResourceDetails/index.tsx index b25951b69..fdfc6aedc 100644 --- a/packages/console/src/pages/ApiResourceDetails/index.tsx +++ b/packages/console/src/pages/ApiResourceDetails/index.tsx @@ -16,7 +16,7 @@ import Drawer from '@/components/Drawer'; import FormField from '@/components/FormField'; import ImagePlaceholder from '@/components/ImagePlaceholder'; import LinkButton from '@/components/LinkButton'; -import TabNav, { TabNavLink } from '@/components/TabNav'; +import TabNav, { TabNavItem } from '@/components/TabNav'; import TextInput from '@/components/TextInput'; import useApi, { RequestError } from '@/hooks/use-api'; import Back from '@/icons/Back'; @@ -144,7 +144,7 @@ const ApiResourceDetails = () => { - {t('api_resource_details.settings')} + {t('api_resource_details.settings')}
diff --git a/packages/console/src/pages/ApplicationDetails/index.tsx b/packages/console/src/pages/ApplicationDetails/index.tsx index e8581e904..339630abb 100644 --- a/packages/console/src/pages/ApplicationDetails/index.tsx +++ b/packages/console/src/pages/ApplicationDetails/index.tsx @@ -15,7 +15,7 @@ import CopyToClipboard from '@/components/CopyToClipboard'; import Drawer from '@/components/Drawer'; import ImagePlaceholder from '@/components/ImagePlaceholder'; import LinkButton from '@/components/LinkButton'; -import TabNav, { TabNavLink } from '@/components/TabNav'; +import TabNav, { TabNavItem } from '@/components/TabNav'; import useApi, { RequestError } from '@/hooks/use-api'; import Back from '@/icons/Back'; import Delete from '@/icons/Delete'; @@ -166,12 +166,12 @@ const ApplicationDetails = () => { - + {t('application_details.settings')} - - + + {t('application_details.advanced_settings')} - + diff --git a/packages/console/src/pages/ConnectorDetails/index.tsx b/packages/console/src/pages/ConnectorDetails/index.tsx index 3c79ef5e6..c70a5fd21 100644 --- a/packages/console/src/pages/ConnectorDetails/index.tsx +++ b/packages/console/src/pages/ConnectorDetails/index.tsx @@ -15,7 +15,7 @@ import ImagePlaceholder from '@/components/ImagePlaceholder'; import LinkButton from '@/components/LinkButton'; import Markdown from '@/components/Markdown'; import Status from '@/components/Status'; -import TabNav, { TabNavLink } from '@/components/TabNav'; +import TabNav, { TabNavItem } from '@/components/TabNav'; import UnnamedTrans from '@/components/UnnamedTrans'; import useApi, { RequestError } from '@/hooks/use-api'; import Back from '@/icons/Back'; @@ -182,9 +182,9 @@ const ConnectorDetails = () => { {data && ( - + {t('connector_details.tab_settings')} - +
{ )}
- {t('connectors.tab_email_sms')} - {t('connectors.tab_social')} + {t('connectors.tab_email_sms')} + {t('connectors.tab_social')}
diff --git a/packages/console/src/pages/Settings/index.tsx b/packages/console/src/pages/Settings/index.tsx index 977a2724e..117f7b368 100644 --- a/packages/console/src/pages/Settings/index.tsx +++ b/packages/console/src/pages/Settings/index.tsx @@ -12,7 +12,7 @@ import Card from '@/components/Card'; import CardTitle from '@/components/CardTitle'; import FormField from '@/components/FormField'; import Select from '@/components/Select'; -import TabNav, { TabNavLink } from '@/components/TabNav'; +import TabNav, { TabNavItem } from '@/components/TabNav'; import { themeStorageKey } from '@/consts'; import useApi, { RequestError } from '@/hooks/use-api'; import * as detailsStyles from '@/scss/details.module.scss'; @@ -57,7 +57,7 @@ const Settings = () => { - {t('settings.tabs.general')} + {t('settings.tabs.general')} {!data && !error &&
loading
} {error &&
{`error occurred: ${error.body.message}`}
} diff --git a/packages/console/src/pages/SignInExperience/components/Preview.module.scss b/packages/console/src/pages/SignInExperience/components/Preview.module.scss new file mode 100644 index 000000000..a7230f807 --- /dev/null +++ b/packages/console/src/pages/SignInExperience/components/Preview.module.scss @@ -0,0 +1,46 @@ +@use '@/scss/underscore' as _; + +.preview { + width: 578px; + display: flex; + flex-direction: column; + padding: 0; + overflow: hidden; + + .header { + display: flex; + margin: _.unit(6) _.unit(6) 0; + + .title { + font: var(--font-subhead-1); + flex: 1; + } + + .selects { + display: flex; + align-items: center; + + > * { + width: 104px; + + &:first-child { + margin-right: _.unit(2); + } + } + } + } + + .nav { + padding: 0 _.unit(6); + } + + .body { + flex: 1; + + iframe { + border: none; + width: 100%; + height: 100%; + } + } +} diff --git a/packages/console/src/pages/SignInExperience/components/Preview.tsx b/packages/console/src/pages/SignInExperience/components/Preview.tsx new file mode 100644 index 000000000..30c0e881d --- /dev/null +++ b/packages/console/src/pages/SignInExperience/components/Preview.tsx @@ -0,0 +1,84 @@ +import { Language } from '@logto/phrases'; +import { AppearanceMode, SignInExperience } from '@logto/schemas'; +import React, { useState } from 'react'; +import { useTranslation } from 'react-i18next'; + +import Card from '@/components/Card'; +import Select from '@/components/Select'; +import TabNav, { TabNavItem } from '@/components/TabNav'; + +import * as styles from './Preview.module.scss'; + +type Props = { + signInExperience: SignInExperience; +}; + +const Preview = ({ signInExperience }: 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'>('web'); + + // TODO: is a placeholder + const config = encodeURIComponent( + JSON.stringify({ + ...signInExperience, + language, + mode, + platform, + }) + ); + + return ( + +
+
{t('sign_in_exp.preview.title')}
+
+ { + setMode(value as AppearanceMode); + }} + /> +
+
+ + { + setPlatform('web'); + }} + > + {t('sign_in_exp.preview.web')} + + { + setPlatform('mobile'); + }} + > + {t('sign_in_exp.preview.mobile')} + + +
+