From 1fa50312819aaddd10a8cb5e2e9ee3b9bbe261ab Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Mon, 19 Aug 2024 10:01:19 -0400 Subject: [PATCH 1/7] chore(ui): Use parsed appearance --- packages/ui/src/common/connections.tsx | 4 ++-- .../ui/src/components/sign-in/steps/choose-session.tsx | 6 +++--- .../ui/src/components/sign-in/steps/choose-strategy.tsx | 4 ++-- .../ui/src/components/sign-in/steps/forgot-password.tsx | 4 ++-- packages/ui/src/components/sign-in/steps/get-help.tsx | 4 ++-- .../ui/src/components/sign-in/steps/reset-password.tsx | 4 ++-- .../ui/src/components/sign-in/steps/verifications.tsx | 4 ++-- packages/ui/src/components/sign-up/steps/continue.tsx | 4 ++-- packages/ui/src/components/sign-up/steps/start.tsx | 4 ++-- .../ui/src/components/sign-up/steps/verifications.tsx | 4 ++-- packages/ui/src/hooks/use-appearance.ts | 8 -------- 11 files changed, 21 insertions(+), 29 deletions(-) delete mode 100644 packages/ui/src/hooks/use-appearance.ts diff --git a/packages/ui/src/common/connections.tsx b/packages/ui/src/common/connections.tsx index 9cedcb82e93..94dbe96aa35 100644 --- a/packages/ui/src/common/connections.tsx +++ b/packages/ui/src/common/connections.tsx @@ -2,7 +2,7 @@ import * as Common from '@clerk/elements/common'; import * as React from 'react'; import { PROVIDERS } from '~/constants/providers'; -import { useAppearance } from '~/hooks/use-appearance'; +import { useAppearance } from '~/contexts'; import { useEnabledConnections } from '~/hooks/use-enabled-connections'; import { Button } from '~/primitives/button'; import * as Icon from '~/primitives/icon'; @@ -58,7 +58,7 @@ export function Connections( props: { columns?: number } & Pick, 'disabled' | 'textVisuallyHidden'>, ) { const enabledConnections = useEnabledConnections(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const hasConnection = enabledConnections.length > 0; const textVisuallyHidden = typeof props?.textVisuallyHidden !== 'undefined' diff --git a/packages/ui/src/components/sign-in/steps/choose-session.tsx b/packages/ui/src/components/sign-in/steps/choose-session.tsx index d75f51b2aec..d9fe0544cbd 100644 --- a/packages/ui/src/components/sign-in/steps/choose-session.tsx +++ b/packages/ui/src/components/sign-in/steps/choose-session.tsx @@ -1,9 +1,9 @@ import { useClerk } from '@clerk/clerk-react'; import { cva } from 'cva'; import { Button } from 'react-aria-components'; -import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/hooks/use-appearance'; +import { LOCALIZATION_NEEDED } from '~/constants/localizations'; +import { useAppearance } from '~/contexts'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; @@ -59,7 +59,7 @@ const sessionAction = cva({ export function SignInChooseSession() { const clerk = useClerk(); const { t } = useLocalizations(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const isDev = useDevModeWarning(); const { branded } = useDisplayConfig(); diff --git a/packages/ui/src/components/sign-in/steps/choose-strategy.tsx b/packages/ui/src/components/sign-in/steps/choose-strategy.tsx index 602119d01e4..2bfbf97b5c4 100644 --- a/packages/ui/src/components/sign-in/steps/choose-strategy.tsx +++ b/packages/ui/src/components/sign-in/steps/choose-strategy.tsx @@ -6,7 +6,7 @@ import { Connections } from '~/common/connections'; import { GlobalError } from '~/common/global-error'; import { useGetHelp } from '~/components/sign-in/hooks/use-get-help'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/hooks/use-appearance'; +import { useAppearance } from '~/contexts'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useEnabledConnections } from '~/hooks/use-enabled-connections'; @@ -48,7 +48,7 @@ function FirstFactorConnections({ export function SignInChooseStrategy() { const enabledConnections = useEnabledConnections(); const { t } = useLocalizations(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); const { setShowHelp } = useGetHelp(); diff --git a/packages/ui/src/components/sign-in/steps/forgot-password.tsx b/packages/ui/src/components/sign-in/steps/forgot-password.tsx index 8f8957b2ff3..2baf5f63131 100644 --- a/packages/ui/src/components/sign-in/steps/forgot-password.tsx +++ b/packages/ui/src/components/sign-in/steps/forgot-password.tsx @@ -5,7 +5,7 @@ import { Connections } from '~/common/connections'; import { GlobalError } from '~/common/global-error'; import { useGetHelp } from '~/components/sign-in/hooks/use-get-help'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/hooks/use-appearance'; +import { useAppearance } from '~/contexts'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; @@ -17,7 +17,7 @@ import { Separator } from '~/primitives/separator'; export function SignInForgotPassword() { const { t } = useLocalizations(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); const { setShowHelp } = useGetHelp(); diff --git a/packages/ui/src/components/sign-in/steps/get-help.tsx b/packages/ui/src/components/sign-in/steps/get-help.tsx index 1db1bf2068d..aa92cfd8e32 100644 --- a/packages/ui/src/components/sign-in/steps/get-help.tsx +++ b/packages/ui/src/components/sign-in/steps/get-help.tsx @@ -1,6 +1,6 @@ import { useGetHelp } from '~/components/sign-in/hooks/use-get-help'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/hooks/use-appearance'; +import { useAppearance } from '~/contexts'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; @@ -13,7 +13,7 @@ import { LinkButton } from '~/primitives/link'; export function SignInGetHelp() { const { t } = useLocalizations(); const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const isDev = useDevModeWarning(); const supportEmail = useSupportEmail(); const { setShowHelp } = useGetHelp(); diff --git a/packages/ui/src/components/sign-in/steps/reset-password.tsx b/packages/ui/src/components/sign-in/steps/reset-password.tsx index 46620eb9e83..a60a41e1927 100644 --- a/packages/ui/src/components/sign-in/steps/reset-password.tsx +++ b/packages/ui/src/components/sign-in/steps/reset-password.tsx @@ -5,7 +5,7 @@ import { CheckboxField } from '~/common/checkbox-field'; import { GlobalError } from '~/common/global-error'; import { PasswordField } from '~/common/password-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/hooks/use-appearance'; +import { useAppearance } from '~/contexts'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; @@ -15,7 +15,7 @@ import { LinkButton } from '~/primitives/link'; export function SignInResetPassword() { const { t } = useLocalizations(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); const isDev = useDevModeWarning(); diff --git a/packages/ui/src/components/sign-in/steps/verifications.tsx b/packages/ui/src/components/sign-in/steps/verifications.tsx index 399ebdf9312..a7c8db2b628 100644 --- a/packages/ui/src/components/sign-in/steps/verifications.tsx +++ b/packages/ui/src/components/sign-in/steps/verifications.tsx @@ -6,7 +6,7 @@ import { GlobalError } from '~/common/global-error'; import { OTPField } from '~/common/otp-field'; import { PasswordField } from '~/common/password-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/hooks/use-appearance'; +import { useAppearance } from '~/contexts'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; @@ -19,7 +19,7 @@ import { formatSafeIdentifier } from '~/utils/format-safe-identifier'; export function SignInVerifications() { const { t } = useLocalizations(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); const isDev = useDevModeWarning(); diff --git a/packages/ui/src/components/sign-up/steps/continue.tsx b/packages/ui/src/components/sign-up/steps/continue.tsx index 37c02d3848a..c68eae55408 100644 --- a/packages/ui/src/components/sign-up/steps/continue.tsx +++ b/packages/ui/src/components/sign-up/steps/continue.tsx @@ -9,7 +9,7 @@ import { PasswordField } from '~/common/password-field'; import { PhoneNumberField } from '~/common/phone-number-field'; import { UsernameField } from '~/common/username-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/hooks/use-appearance'; +import { useAppearance } from '~/contexts'; import { useAttributes } from '~/hooks/use-attributes'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; @@ -20,7 +20,7 @@ import * as Icon from '~/primitives/icon'; export function SignUpContinue() { const { t } = useLocalizations(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const { enabled: firstNameEnabled, required: firstNameRequired } = useAttributes('first_name'); const { enabled: lastNameEnabled, required: lastNameRequired } = useAttributes('last_name'); const { enabled: usernameEnabled, required: usernameRequired } = useAttributes('username'); diff --git a/packages/ui/src/components/sign-up/steps/start.tsx b/packages/ui/src/components/sign-up/steps/start.tsx index 2a37c627bb3..c02b1e3de93 100644 --- a/packages/ui/src/components/sign-up/steps/start.tsx +++ b/packages/ui/src/components/sign-up/steps/start.tsx @@ -12,7 +12,7 @@ import { PasswordField } from '~/common/password-field'; import { PhoneNumberField } from '~/common/phone-number-field'; import { UsernameField } from '~/common/username-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/hooks/use-appearance'; +import { useAppearance } from '~/contexts'; import { useAttributes } from '~/hooks/use-attributes'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; @@ -28,7 +28,7 @@ export function SignUpStart() { const clerk = useClerk(); const enabledConnections = useEnabledConnections(); const { userSettings } = useEnvironment(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const { t } = useLocalizations(); const { enabled: firstNameEnabled, required: firstNameRequired } = useAttributes('first_name'); const { enabled: lastNameEnabled, required: lastNameRequired } = useAttributes('last_name'); diff --git a/packages/ui/src/components/sign-up/steps/verifications.tsx b/packages/ui/src/components/sign-up/steps/verifications.tsx index f5eeb600091..b593204093f 100644 --- a/packages/ui/src/components/sign-up/steps/verifications.tsx +++ b/packages/ui/src/components/sign-up/steps/verifications.tsx @@ -5,7 +5,7 @@ import * as SignUp from '@clerk/elements/sign-up'; import { GlobalError } from '~/common/global-error'; import { OTPField } from '~/common/otp-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/hooks/use-appearance'; +import { useAppearance } from '~/contexts'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; @@ -46,7 +46,7 @@ function SignUpIdentifier({ emailAddress, phoneNumber }: Identifier) { export function SignUpVerifications() { const { t } = useLocalizations(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const { branded, applicationName, homeUrl, logoImageUrl } = useDisplayConfig(); const isDev = useDevModeWarning(); diff --git a/packages/ui/src/hooks/use-appearance.ts b/packages/ui/src/hooks/use-appearance.ts deleted file mode 100644 index 027ba9a1eb2..00000000000 --- a/packages/ui/src/hooks/use-appearance.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { Appearance } from '@clerk/types'; - -import { useOptions } from './use-options'; - -export function useAppearance() { - const { appearance } = useOptions(); - return (appearance as Appearance) || {}; -} From 151601a2e6c81d75ec3952915893f95ed240562d Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Mon, 19 Aug 2024 10:34:25 -0400 Subject: [PATCH 2/7] more parsedAppearance usage --- .../ui/src/components/sign-in/sign-in.tsx | 2 +- .../sign-in/steps/choose-strategy.tsx | 13 ++-- .../sign-in/steps/forgot-password.tsx | 13 ++-- .../src/components/sign-in/steps/get-help.tsx | 13 ++-- .../sign-in/steps/reset-password.tsx | 13 ++-- .../ui/src/components/sign-in/steps/start.tsx | 13 ++-- .../sign-in/steps/verifications.tsx | 61 ++++--------------- .../src/components/sign-up/steps/continue.tsx | 13 ++-- .../ui/src/components/sign-up/steps/start.tsx | 13 ++-- .../sign-up/steps/verifications.tsx | 29 +++------ packages/ui/src/hooks/use-dev-mode-warning.ts | 5 +- packages/ui/src/primitives/card.tsx | 4 ++ 12 files changed, 70 insertions(+), 122 deletions(-) diff --git a/packages/ui/src/components/sign-in/sign-in.tsx b/packages/ui/src/components/sign-in/sign-in.tsx index 6491a0b0f96..3c6fa61d35c 100644 --- a/packages/ui/src/components/sign-in/sign-in.tsx +++ b/packages/ui/src/components/sign-in/sign-in.tsx @@ -8,7 +8,7 @@ import { SignInGetHelp } from '~/components/sign-in/steps/get-help'; import { SignInResetPassword } from '~/components/sign-in/steps/reset-password'; import { SignInStart } from '~/components/sign-in/steps/start'; import { SignInVerifications } from '~/components/sign-in/steps/verifications'; -import { useAppearance, AppearanceProvider, type Appearance } from '~/contexts'; +import { type Appearance, AppearanceProvider, useAppearance } from '~/contexts'; /** * Implementation Details: diff --git a/packages/ui/src/components/sign-in/steps/choose-strategy.tsx b/packages/ui/src/components/sign-in/steps/choose-strategy.tsx index 2bfbf97b5c4..3d26f89d815 100644 --- a/packages/ui/src/components/sign-in/steps/choose-strategy.tsx +++ b/packages/ui/src/components/sign-in/steps/choose-strategy.tsx @@ -54,6 +54,11 @@ export function SignInChooseStrategy() { const hasConnection = enabledConnections.length > 0; const isDev = useDevModeWarning(); + const cardLogoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; const cardFooterProps = { branded, helpPageUrl: layout?.helpPageUrl, @@ -69,13 +74,7 @@ export function SignInChooseStrategy() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.alternativeMethods.title')} {t('signIn.alternativeMethods.subtitle')} diff --git a/packages/ui/src/components/sign-in/steps/forgot-password.tsx b/packages/ui/src/components/sign-in/steps/forgot-password.tsx index 2baf5f63131..28e000cf545 100644 --- a/packages/ui/src/components/sign-in/steps/forgot-password.tsx +++ b/packages/ui/src/components/sign-in/steps/forgot-password.tsx @@ -22,6 +22,11 @@ export function SignInForgotPassword() { const { setShowHelp } = useGetHelp(); const isDev = useDevModeWarning(); + const cardLogoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; const cardFooterProps = { branded, helpPageUrl: layout?.helpPageUrl, @@ -37,13 +42,7 @@ export function SignInForgotPassword() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.forgotPasswordAlternativeMethods.title')} diff --git a/packages/ui/src/components/sign-in/steps/get-help.tsx b/packages/ui/src/components/sign-in/steps/get-help.tsx index aa92cfd8e32..5aed9426b60 100644 --- a/packages/ui/src/components/sign-in/steps/get-help.tsx +++ b/packages/ui/src/components/sign-in/steps/get-help.tsx @@ -18,6 +18,11 @@ export function SignInGetHelp() { const supportEmail = useSupportEmail(); const { setShowHelp } = useGetHelp(); + const cardLogoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; const cardFooterProps = { branded, helpPageUrl: layout?.helpPageUrl, @@ -29,13 +34,7 @@ export function SignInGetHelp() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.alternativeMethods.getHelp.title')} {t('signIn.alternativeMethods.getHelp.content')} diff --git a/packages/ui/src/components/sign-in/steps/reset-password.tsx b/packages/ui/src/components/sign-in/steps/reset-password.tsx index a60a41e1927..616d3214015 100644 --- a/packages/ui/src/components/sign-in/steps/reset-password.tsx +++ b/packages/ui/src/components/sign-in/steps/reset-password.tsx @@ -19,6 +19,11 @@ export function SignInResetPassword() { const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); const isDev = useDevModeWarning(); + const cardLogoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; const cardFooterProps = { branded, helpPageUrl: layout?.helpPageUrl, @@ -34,13 +39,7 @@ export function SignInResetPassword() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.resetPassword.title')} diff --git a/packages/ui/src/components/sign-in/steps/start.tsx b/packages/ui/src/components/sign-in/steps/start.tsx index d5b12d17f69..ab12c3b51db 100644 --- a/packages/ui/src/components/sign-in/steps/start.tsx +++ b/packages/ui/src/components/sign-in/steps/start.tsx @@ -36,6 +36,11 @@ export function SignInStart() { const hasConnection = enabledConnections.length > 0; const hasIdentifier = emailAddressEnabled || usernameEnabled || phoneNumberEnabled; const isDev = useDevModeWarning(); + const cardLogoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; const cardFooterProps = { branded, helpPageUrl: layout?.helpPageUrl, @@ -51,13 +56,7 @@ export function SignInStart() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.start.title', { applicationName })} {t('signIn.start.subtitle', { applicationName })} diff --git a/packages/ui/src/components/sign-in/steps/verifications.tsx b/packages/ui/src/components/sign-in/steps/verifications.tsx index a7c8db2b628..314007c8f92 100644 --- a/packages/ui/src/components/sign-in/steps/verifications.tsx +++ b/packages/ui/src/components/sign-in/steps/verifications.tsx @@ -24,6 +24,11 @@ export function SignInVerifications() { const isDev = useDevModeWarning(); const isPasswordResetSupported = useResetPasswordFactor(); + const cardLogoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; const cardFooterProps = { branded, helpPageUrl: layout?.helpPageUrl, @@ -40,13 +45,7 @@ export function SignInVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.password.title')} {t('signIn.password.subtitle')} @@ -123,13 +122,7 @@ export function SignInVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.passkey.title')} {t('signIn.passkey.subtitle')} @@ -183,13 +176,7 @@ export function SignInVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.backupCodeMfa.title')} {t('signIn.backupCodeMfa.subtitle')} @@ -235,13 +222,7 @@ export function SignInVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.emailCode.title')} {t('signIn.emailCode.subtitle', { applicationName })} @@ -320,13 +301,7 @@ export function SignInVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.phoneCode.title')} {t('signIn.phoneCode.subtitle', { applicationName })} @@ -406,13 +381,7 @@ export function SignInVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.emailLink.title')} {t('signIn.emailLink.formSubtitle', { applicationName })} @@ -523,13 +492,7 @@ export function SignInVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signIn.totpMfa.formTitle')} {t('signIn.totpMfa.subtitle', { applicationName })} diff --git a/packages/ui/src/components/sign-up/steps/continue.tsx b/packages/ui/src/components/sign-up/steps/continue.tsx index c68eae55408..05044b45f53 100644 --- a/packages/ui/src/components/sign-up/steps/continue.tsx +++ b/packages/ui/src/components/sign-up/steps/continue.tsx @@ -28,6 +28,11 @@ export function SignUpContinue() { const { enabled: passwordEnabled, required: passwordRequired } = useAttributes('password'); const { branded, applicationName, homeUrl, logoImageUrl } = useDisplayConfig(); const isDev = useDevModeWarning(); + const cardLogoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; const cardFooterProps = { branded, helpPageUrl: layout?.helpPageUrl, @@ -43,13 +48,7 @@ export function SignUpContinue() { - {logoImageUrl ? ( - - ) : null} + {t('signUp.continue.title')} {t('signUp.continue.subtitle')} diff --git a/packages/ui/src/components/sign-up/steps/start.tsx b/packages/ui/src/components/sign-up/steps/start.tsx index c02b1e3de93..68042c7009e 100644 --- a/packages/ui/src/components/sign-up/steps/start.tsx +++ b/packages/ui/src/components/sign-up/steps/start.tsx @@ -41,6 +41,11 @@ export function SignUpStart() { const hasConnection = enabledConnections.length > 0; const hasIdentifier = emailAddressEnabled || usernameEnabled || phoneNumberEnabled; const isDev = useDevModeWarning(); + const cardLogoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; const cardFooterProps = { branded, helpPageUrl: layout?.helpPageUrl, @@ -56,13 +61,7 @@ export function SignUpStart() { - {logoImageUrl ? ( - - ) : null} + {t('signUp.start.title')} {t('signUp.start.subtitle', { diff --git a/packages/ui/src/components/sign-up/steps/verifications.tsx b/packages/ui/src/components/sign-up/steps/verifications.tsx index b593204093f..760cdab539c 100644 --- a/packages/ui/src/components/sign-up/steps/verifications.tsx +++ b/packages/ui/src/components/sign-up/steps/verifications.tsx @@ -50,6 +50,11 @@ export function SignUpVerifications() { const { branded, applicationName, homeUrl, logoImageUrl } = useDisplayConfig(); const isDev = useDevModeWarning(); + const cardLogoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; const cardFooterProps = { branded, helpPageUrl: layout?.helpPageUrl, @@ -66,13 +71,7 @@ export function SignUpVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signUp.phoneCode.title')} {t('signUp.phoneCode.subtitle')} @@ -144,13 +143,7 @@ export function SignUpVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signUp.emailCode.title')} {t('signUp.emailCode.subtitle')} @@ -222,13 +215,7 @@ export function SignUpVerifications() { - {logoImageUrl ? ( - - ) : null} + {t('signUp.emailLink.title')} {t('signUp.emailLink.subtitle', { diff --git a/packages/ui/src/hooks/use-dev-mode-warning.ts b/packages/ui/src/hooks/use-dev-mode-warning.ts index 7f2328f8340..202bd4c0d9f 100644 --- a/packages/ui/src/hooks/use-dev-mode-warning.ts +++ b/packages/ui/src/hooks/use-dev-mode-warning.ts @@ -1,12 +1,13 @@ import { useMemo } from 'react'; -import { useAppearance } from './use-appearance'; +import { useAppearance } from '~/contexts'; + import { useEnvironment } from './use-environment'; export function useDevModeWarning() { const { displayConfig, isDevelopmentOrStaging } = useEnvironment(); const isDevelopment = isDevelopmentOrStaging(); - const { layout } = useAppearance(); + const { layout } = useAppearance().parsedAppearance; const unsafeDisabled = layout?.unsafe_disableDevelopmentModeWarnings || false; const developmentUiDisabled = isDevelopment && unsafeDisabled; const showDevModeWarning = useMemo( diff --git a/packages/ui/src/primitives/card.tsx b/packages/ui/src/primitives/card.tsx index dc1f4b61959..e942ee3c693 100644 --- a/packages/ui/src/primitives/card.tsx +++ b/packages/ui/src/primitives/card.tsx @@ -106,6 +106,10 @@ export const Logo = React.forwardRef(function CardLogo( }, forwardedRef: React.ForwardedRef, ) { + if (!src) { + return null; + } + const img = ( Date: Mon, 19 Aug 2024 14:06:07 -0400 Subject: [PATCH 3/7] feat(ui): Add useCard hook --- .../sign-in/steps/choose-strategy.tsx | 21 +++--------- .../sign-in/steps/forgot-password.tsx | 21 +++--------- .../sign-in/steps/reset-password.tsx | 21 +++--------- .../ui/src/components/sign-in/steps/start.tsx | 21 +++--------- .../sign-in/steps/verifications.tsx | 33 +++++++------------ .../src/components/sign-up/steps/continue.tsx | 21 +++--------- .../ui/src/components/sign-up/steps/start.tsx | 21 +++--------- .../sign-up/steps/verifications.tsx | 25 ++++---------- packages/ui/src/hooks/use-card.ts | 26 +++++++++++++++ .../app/sign-in/[[...sign-in]]/page.tsx | 10 +++++- .../public/clerk-logo-dark-accent.svg | 6 ++++ 11 files changed, 85 insertions(+), 141 deletions(-) create mode 100644 packages/ui/src/hooks/use-card.ts create mode 100644 packages/ui/theme-builder/public/clerk-logo-dark-accent.svg diff --git a/packages/ui/src/components/sign-in/steps/choose-strategy.tsx b/packages/ui/src/components/sign-in/steps/choose-strategy.tsx index 3d26f89d815..8d8020c3b61 100644 --- a/packages/ui/src/components/sign-in/steps/choose-strategy.tsx +++ b/packages/ui/src/components/sign-in/steps/choose-strategy.tsx @@ -6,9 +6,8 @@ import { Connections } from '~/common/connections'; import { GlobalError } from '~/common/global-error'; import { useGetHelp } from '~/components/sign-in/hooks/use-get-help'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/contexts'; +import { useCard } from '~/hooks/use-card'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; -import { useDisplayConfig } from '~/hooks/use-display-config'; import { useEnabledConnections } from '~/hooks/use-enabled-connections'; import { useLocalizations } from '~/hooks/use-localizations'; import { Button } from '~/primitives/button'; @@ -48,23 +47,11 @@ function FirstFactorConnections({ export function SignInChooseStrategy() { const enabledConnections = useEnabledConnections(); const { t } = useLocalizations(); - const { layout } = useAppearance().parsedAppearance; - const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); const { setShowHelp } = useGetHelp(); const hasConnection = enabledConnections.length > 0; const isDev = useDevModeWarning(); - const cardLogoProps = { - href: layout?.logoLinkUrl || homeUrl, - src: layout?.logoImageUrl || logoImageUrl, - alt: applicationName, - }; - const cardFooterProps = { - branded, - helpPageUrl: layout?.helpPageUrl, - privacyPageUrl: layout?.privacyPageUrl, - termsPageUrl: layout?.termsPageUrl, - }; + const { logoProps, footerProps } = useCard(); return ( @@ -74,7 +61,7 @@ export function SignInChooseStrategy() { - + {t('signIn.alternativeMethods.title')} {t('signIn.alternativeMethods.subtitle')} @@ -197,7 +184,7 @@ export function SignInChooseStrategy() { - + {t('signIn.alternativeMethods.actionText')}{' '} diff --git a/packages/ui/src/components/sign-in/steps/forgot-password.tsx b/packages/ui/src/components/sign-in/steps/forgot-password.tsx index 28e000cf545..86a35b37b33 100644 --- a/packages/ui/src/components/sign-in/steps/forgot-password.tsx +++ b/packages/ui/src/components/sign-in/steps/forgot-password.tsx @@ -5,9 +5,8 @@ import { Connections } from '~/common/connections'; import { GlobalError } from '~/common/global-error'; import { useGetHelp } from '~/components/sign-in/hooks/use-get-help'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/contexts'; +import { useCard } from '~/hooks/use-card'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; -import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; import { Button } from '~/primitives/button'; import * as Card from '~/primitives/card'; @@ -17,22 +16,10 @@ import { Separator } from '~/primitives/separator'; export function SignInForgotPassword() { const { t } = useLocalizations(); - const { layout } = useAppearance().parsedAppearance; - const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); const { setShowHelp } = useGetHelp(); const isDev = useDevModeWarning(); - const cardLogoProps = { - href: layout?.logoLinkUrl || homeUrl, - src: layout?.logoImageUrl || logoImageUrl, - alt: applicationName, - }; - const cardFooterProps = { - branded, - helpPageUrl: layout?.helpPageUrl, - privacyPageUrl: layout?.privacyPageUrl, - termsPageUrl: layout?.termsPageUrl, - }; + const { logoProps, footerProps } = useCard(); return ( @@ -42,7 +29,7 @@ export function SignInForgotPassword() { - + {t('signIn.forgotPasswordAlternativeMethods.title')} @@ -152,7 +139,7 @@ export function SignInForgotPassword() { - + {t('signIn.alternativeMethods.actionText')}{' '} diff --git a/packages/ui/src/components/sign-in/steps/reset-password.tsx b/packages/ui/src/components/sign-in/steps/reset-password.tsx index 616d3214015..5449ef8ae60 100644 --- a/packages/ui/src/components/sign-in/steps/reset-password.tsx +++ b/packages/ui/src/components/sign-in/steps/reset-password.tsx @@ -5,9 +5,8 @@ import { CheckboxField } from '~/common/checkbox-field'; import { GlobalError } from '~/common/global-error'; import { PasswordField } from '~/common/password-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/contexts'; +import { useCard } from '~/hooks/use-card'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; -import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; import { Button } from '~/primitives/button'; import * as Card from '~/primitives/card'; @@ -15,21 +14,9 @@ import { LinkButton } from '~/primitives/link'; export function SignInResetPassword() { const { t } = useLocalizations(); - const { layout } = useAppearance().parsedAppearance; - const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); const isDev = useDevModeWarning(); - const cardLogoProps = { - href: layout?.logoLinkUrl || homeUrl, - src: layout?.logoImageUrl || logoImageUrl, - alt: applicationName, - }; - const cardFooterProps = { - branded, - helpPageUrl: layout?.helpPageUrl, - privacyPageUrl: layout?.privacyPageUrl, - termsPageUrl: layout?.termsPageUrl, - }; + const { logoProps, footerProps } = useCard(); return ( @@ -39,7 +26,7 @@ export function SignInResetPassword() { - + {t('signIn.resetPassword.title')} @@ -92,7 +79,7 @@ export function SignInResetPassword() { - + ); diff --git a/packages/ui/src/components/sign-in/steps/start.tsx b/packages/ui/src/components/sign-in/steps/start.tsx index ab12c3b51db..c34b25472c6 100644 --- a/packages/ui/src/components/sign-in/steps/start.tsx +++ b/packages/ui/src/components/sign-in/steps/start.tsx @@ -11,8 +11,8 @@ import { PhoneNumberField } from '~/common/phone-number-field'; import { PhoneNumberOrUsernameField } from '~/common/phone-number-or-username-field'; import { UsernameField } from '~/common/username-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/contexts'; import { useAttributes } from '~/hooks/use-attributes'; +import { useCard } from '~/hooks/use-card'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useEnabledConnections } from '~/hooks/use-enabled-connections'; @@ -26,27 +26,16 @@ import { Separator } from '~/primitives/separator'; export function SignInStart() { const enabledConnections = useEnabledConnections(); const { t } = useLocalizations(); - const { layout } = useAppearance().parsedAppearance; const { enabled: usernameEnabled } = useAttributes('username'); const { enabled: phoneNumberEnabled } = useAttributes('phone_number'); const { enabled: emailAddressEnabled } = useAttributes('email_address'); const { enabled: passkeyEnabled } = useAttributes('passkey'); - const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); + const { applicationName } = useDisplayConfig(); const hasConnection = enabledConnections.length > 0; const hasIdentifier = emailAddressEnabled || usernameEnabled || phoneNumberEnabled; const isDev = useDevModeWarning(); - const cardLogoProps = { - href: layout?.logoLinkUrl || homeUrl, - src: layout?.logoImageUrl || logoImageUrl, - alt: applicationName, - }; - const cardFooterProps = { - branded, - helpPageUrl: layout?.helpPageUrl, - privacyPageUrl: layout?.privacyPageUrl, - termsPageUrl: layout?.termsPageUrl, - }; + const { logoProps, footerProps } = useCard(); return ( @@ -56,7 +45,7 @@ export function SignInStart() { - + {t('signIn.start.title', { applicationName })} {t('signIn.start.subtitle', { applicationName })} @@ -180,7 +169,7 @@ export function SignInStart() { - + {t('signIn.start.actionText')}{' '} diff --git a/packages/ui/src/components/sign-in/steps/verifications.tsx b/packages/ui/src/components/sign-in/steps/verifications.tsx index 314007c8f92..01a49f652c5 100644 --- a/packages/ui/src/components/sign-in/steps/verifications.tsx +++ b/packages/ui/src/components/sign-in/steps/verifications.tsx @@ -6,7 +6,7 @@ import { GlobalError } from '~/common/global-error'; import { OTPField } from '~/common/otp-field'; import { PasswordField } from '~/common/password-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/contexts'; +import { useCard } from '~/hooks/use-card'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; @@ -19,22 +19,11 @@ import { formatSafeIdentifier } from '~/utils/format-safe-identifier'; export function SignInVerifications() { const { t } = useLocalizations(); - const { layout } = useAppearance().parsedAppearance; - const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); + const { applicationName } = useDisplayConfig(); const isDev = useDevModeWarning(); const isPasswordResetSupported = useResetPasswordFactor(); - const cardLogoProps = { - href: layout?.logoLinkUrl || homeUrl, - src: layout?.logoImageUrl || logoImageUrl, - alt: applicationName, - }; - const cardFooterProps = { - branded, - helpPageUrl: layout?.helpPageUrl, - privacyPageUrl: layout?.privacyPageUrl, - termsPageUrl: layout?.termsPageUrl, - }; + const { logoProps, footerProps } = useCard(); return ( @@ -45,7 +34,7 @@ export function SignInVerifications() { - + {t('signIn.password.title')} {t('signIn.password.subtitle')} @@ -122,7 +111,7 @@ export function SignInVerifications() { - + {t('signIn.passkey.title')} {t('signIn.passkey.subtitle')} @@ -176,7 +165,7 @@ export function SignInVerifications() { - + {t('signIn.backupCodeMfa.title')} {t('signIn.backupCodeMfa.subtitle')} @@ -222,7 +211,7 @@ export function SignInVerifications() { - + {t('signIn.emailCode.title')} {t('signIn.emailCode.subtitle', { applicationName })} @@ -301,7 +290,7 @@ export function SignInVerifications() { - + {t('signIn.phoneCode.title')} {t('signIn.phoneCode.subtitle', { applicationName })} @@ -381,7 +370,7 @@ export function SignInVerifications() { - + {t('signIn.emailLink.title')} {t('signIn.emailLink.formSubtitle', { applicationName })} @@ -492,7 +481,7 @@ export function SignInVerifications() { - + {t('signIn.totpMfa.formTitle')} {t('signIn.totpMfa.subtitle', { applicationName })} @@ -534,7 +523,7 @@ export function SignInVerifications() { - + ); diff --git a/packages/ui/src/components/sign-up/steps/continue.tsx b/packages/ui/src/components/sign-up/steps/continue.tsx index 05044b45f53..54380ff92a0 100644 --- a/packages/ui/src/components/sign-up/steps/continue.tsx +++ b/packages/ui/src/components/sign-up/steps/continue.tsx @@ -9,10 +9,9 @@ import { PasswordField } from '~/common/password-field'; import { PhoneNumberField } from '~/common/phone-number-field'; import { UsernameField } from '~/common/username-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/contexts'; import { useAttributes } from '~/hooks/use-attributes'; +import { useCard } from '~/hooks/use-card'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; -import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; import { Button } from '~/primitives/button'; import * as Card from '~/primitives/card'; @@ -20,25 +19,13 @@ import * as Icon from '~/primitives/icon'; export function SignUpContinue() { const { t } = useLocalizations(); - const { layout } = useAppearance().parsedAppearance; const { enabled: firstNameEnabled, required: firstNameRequired } = useAttributes('first_name'); const { enabled: lastNameEnabled, required: lastNameRequired } = useAttributes('last_name'); const { enabled: usernameEnabled, required: usernameRequired } = useAttributes('username'); const { enabled: phoneNumberEnabled, required: phoneNumberRequired } = useAttributes('phone_number'); const { enabled: passwordEnabled, required: passwordRequired } = useAttributes('password'); - const { branded, applicationName, homeUrl, logoImageUrl } = useDisplayConfig(); const isDev = useDevModeWarning(); - const cardLogoProps = { - href: layout?.logoLinkUrl || homeUrl, - src: layout?.logoImageUrl || logoImageUrl, - alt: applicationName, - }; - const cardFooterProps = { - branded, - helpPageUrl: layout?.helpPageUrl, - privacyPageUrl: layout?.privacyPageUrl, - termsPageUrl: layout?.termsPageUrl, - }; + const { logoProps, footerProps } = useCard(); return ( @@ -48,7 +35,7 @@ export function SignUpContinue() { - + {t('signUp.continue.title')} {t('signUp.continue.subtitle')} @@ -117,7 +104,7 @@ export function SignUpContinue() { - + {t('signUp.continue.actionText')}{' '} diff --git a/packages/ui/src/components/sign-up/steps/start.tsx b/packages/ui/src/components/sign-up/steps/start.tsx index 68042c7009e..f2f4693fabb 100644 --- a/packages/ui/src/components/sign-up/steps/start.tsx +++ b/packages/ui/src/components/sign-up/steps/start.tsx @@ -12,8 +12,8 @@ import { PasswordField } from '~/common/password-field'; import { PhoneNumberField } from '~/common/phone-number-field'; import { UsernameField } from '~/common/username-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/contexts'; import { useAttributes } from '~/hooks/use-attributes'; +import { useCard } from '~/hooks/use-card'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useEnabledConnections } from '~/hooks/use-enabled-connections'; @@ -28,7 +28,6 @@ export function SignUpStart() { const clerk = useClerk(); const enabledConnections = useEnabledConnections(); const { userSettings } = useEnvironment(); - const { layout } = useAppearance().parsedAppearance; const { t } = useLocalizations(); const { enabled: firstNameEnabled, required: firstNameRequired } = useAttributes('first_name'); const { enabled: lastNameEnabled, required: lastNameRequired } = useAttributes('last_name'); @@ -36,22 +35,12 @@ export function SignUpStart() { const { enabled: phoneNumberEnabled, required: phoneNumberRequired } = useAttributes('phone_number'); const { enabled: emailAddressEnabled, required: emailAddressRequired } = useAttributes('email_address'); const { enabled: passwordEnabled, required: passwordRequired } = useAttributes('password'); - const { applicationName, branded, homeUrl, logoImageUrl } = useDisplayConfig(); + const { applicationName } = useDisplayConfig(); const hasConnection = enabledConnections.length > 0; const hasIdentifier = emailAddressEnabled || usernameEnabled || phoneNumberEnabled; const isDev = useDevModeWarning(); - const cardLogoProps = { - href: layout?.logoLinkUrl || homeUrl, - src: layout?.logoImageUrl || logoImageUrl, - alt: applicationName, - }; - const cardFooterProps = { - branded, - helpPageUrl: layout?.helpPageUrl, - privacyPageUrl: layout?.privacyPageUrl, - termsPageUrl: layout?.termsPageUrl, - }; + const { logoProps, footerProps } = useCard(); return ( @@ -61,7 +50,7 @@ export function SignUpStart() { - + {t('signUp.start.title')} {t('signUp.start.subtitle', { @@ -154,7 +143,7 @@ export function SignUpStart() { ) : null} - + {t('signUp.start.actionText')}{' '} diff --git a/packages/ui/src/components/sign-up/steps/verifications.tsx b/packages/ui/src/components/sign-up/steps/verifications.tsx index 760cdab539c..9498ae1d33e 100644 --- a/packages/ui/src/components/sign-up/steps/verifications.tsx +++ b/packages/ui/src/components/sign-up/steps/verifications.tsx @@ -5,7 +5,7 @@ import * as SignUp from '@clerk/elements/sign-up'; import { GlobalError } from '~/common/global-error'; import { OTPField } from '~/common/otp-field'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/contexts'; +import { useCard } from '~/hooks/use-card'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; @@ -46,21 +46,10 @@ function SignUpIdentifier({ emailAddress, phoneNumber }: Identifier) { export function SignUpVerifications() { const { t } = useLocalizations(); - const { layout } = useAppearance().parsedAppearance; - const { branded, applicationName, homeUrl, logoImageUrl } = useDisplayConfig(); + const { applicationName } = useDisplayConfig(); const isDev = useDevModeWarning(); - const cardLogoProps = { - href: layout?.logoLinkUrl || homeUrl, - src: layout?.logoImageUrl || logoImageUrl, - alt: applicationName, - }; - const cardFooterProps = { - branded, - helpPageUrl: layout?.helpPageUrl, - privacyPageUrl: layout?.privacyPageUrl, - termsPageUrl: layout?.termsPageUrl, - }; + const { logoProps, footerProps } = useCard(); return ( @@ -71,7 +60,7 @@ export function SignUpVerifications() { - + {t('signUp.phoneCode.title')} {t('signUp.phoneCode.subtitle')} @@ -143,7 +132,7 @@ export function SignUpVerifications() { - + {t('signUp.emailCode.title')} {t('signUp.emailCode.subtitle')} @@ -215,7 +204,7 @@ export function SignUpVerifications() { - + {t('signUp.emailLink.title')} {t('signUp.emailLink.subtitle', { @@ -265,7 +254,7 @@ export function SignUpVerifications() { - + ); diff --git a/packages/ui/src/hooks/use-card.ts b/packages/ui/src/hooks/use-card.ts new file mode 100644 index 00000000000..37b385796d0 --- /dev/null +++ b/packages/ui/src/hooks/use-card.ts @@ -0,0 +1,26 @@ +import { useAppearance } from '~/contexts'; + +import { useDisplayConfig } from './use-display-config'; + +export function useCard() { + const { layout } = useAppearance().parsedAppearance; + const { applicationName, branded, logoImageUrl, homeUrl } = useDisplayConfig(); + + const logoProps = { + href: layout?.logoLinkUrl || homeUrl, + src: layout?.logoImageUrl || logoImageUrl, + alt: applicationName, + }; + + const footerProps = { + branded, + helpPageUrl: layout?.helpPageUrl, + privacyPageUrl: layout?.privacyPageUrl, + termsPageUrl: layout?.termsPageUrl, + }; + + return { + logoProps, + footerProps, + }; +} diff --git a/packages/ui/theme-builder/app/sign-in/[[...sign-in]]/page.tsx b/packages/ui/theme-builder/app/sign-in/[[...sign-in]]/page.tsx index 19cf4e29c84..1d87c6b5ae9 100644 --- a/packages/ui/theme-builder/app/sign-in/[[...sign-in]]/page.tsx +++ b/packages/ui/theme-builder/app/sign-in/[[...sign-in]]/page.tsx @@ -2,5 +2,13 @@ import { SignIn } from '@clerk/ui/sign-in'; export default function Page() { - return ; + return ( + + ); } diff --git a/packages/ui/theme-builder/public/clerk-logo-dark-accent.svg b/packages/ui/theme-builder/public/clerk-logo-dark-accent.svg new file mode 100644 index 00000000000..294837b0965 --- /dev/null +++ b/packages/ui/theme-builder/public/clerk-logo-dark-accent.svg @@ -0,0 +1,6 @@ + + + + + + From 29e23ed71df77274d82c12589ba6e7dbe15a0d87 Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Mon, 19 Aug 2024 14:08:13 -0400 Subject: [PATCH 4/7] revert signin override --- .../theme-builder/app/sign-in/[[...sign-in]]/page.tsx | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/ui/theme-builder/app/sign-in/[[...sign-in]]/page.tsx b/packages/ui/theme-builder/app/sign-in/[[...sign-in]]/page.tsx index 1d87c6b5ae9..19cf4e29c84 100644 --- a/packages/ui/theme-builder/app/sign-in/[[...sign-in]]/page.tsx +++ b/packages/ui/theme-builder/app/sign-in/[[...sign-in]]/page.tsx @@ -2,13 +2,5 @@ import { SignIn } from '@clerk/ui/sign-in'; export default function Page() { - return ( - - ); + return ; } From 61505a9901052384400abfce1c7c3bb1a00ac55a Mon Sep 17 00:00:00 2001 From: Alex Carpenter Date: Mon, 19 Aug 2024 15:31:36 -0400 Subject: [PATCH 5/7] update choose session --- packages/ui/src/components/sign-in/sign-in.tsx | 3 +-- .../components/sign-in/steps/choose-session.tsx | 15 +++------------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/ui/src/components/sign-in/sign-in.tsx b/packages/ui/src/components/sign-in/sign-in.tsx index e47313ad243..d2921eb2058 100644 --- a/packages/ui/src/components/sign-in/sign-in.tsx +++ b/packages/ui/src/components/sign-in/sign-in.tsx @@ -2,6 +2,7 @@ import { Root as SignInRoot } from '@clerk/elements/sign-in'; import * as React from 'react'; import { GetHelpContext } from '~/components/sign-in/hooks/use-get-help'; +import { SignInChooseSession } from '~/components/sign-in/steps/choose-session'; import { SignInChooseStrategy } from '~/components/sign-in/steps/choose-strategy'; import { SignInForgotPassword } from '~/components/sign-in/steps/forgot-password'; import { SignInGetHelp } from '~/components/sign-in/steps/get-help'; @@ -10,8 +11,6 @@ import { SignInStart } from '~/components/sign-in/steps/start'; import { SignInVerifications } from '~/components/sign-in/steps/verifications'; import { type Appearance, AppearanceProvider, useAppearance } from '~/contexts'; -import { SignInChooseSession } from './steps/choose-session'; - /** * Implementation Details: * diff --git a/packages/ui/src/components/sign-in/steps/choose-session.tsx b/packages/ui/src/components/sign-in/steps/choose-session.tsx index f22673ef800..833b82aa25c 100644 --- a/packages/ui/src/components/sign-in/steps/choose-session.tsx +++ b/packages/ui/src/components/sign-in/steps/choose-session.tsx @@ -4,9 +4,8 @@ import { cva } from 'cva'; import { Button } from 'react-aria-components'; import { LOCALIZATION_NEEDED } from '~/constants/localizations'; -import { useAppearance } from '~/contexts'; +import { useCard } from '~/hooks/use-card'; import { useDevModeWarning } from '~/hooks/use-dev-mode-warning'; -import { useDisplayConfig } from '~/hooks/use-display-config'; import { useLocalizations } from '~/hooks/use-localizations'; import * as Card from '~/primitives/card'; import * as Icon from '~/primitives/icon'; @@ -60,16 +59,8 @@ const sessionAction = cva({ export function SignInChooseSession() { const { signOut } = useClerk(); const { t } = useLocalizations(); - const { layout } = useAppearance().parsedAppearance; const isDev = useDevModeWarning(); - const { branded } = useDisplayConfig(); - - const cardFooterProps = { - branded, - helpPageUrl: layout?.helpPageUrl, - privacyPageUrl: layout?.privacyPageUrl, - termsPageUrl: layout?.termsPageUrl, - }; + const { footerProps } = useCard(); return ( @@ -160,7 +151,7 @@ export function SignInChooseSession() { - +