Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/wise-badgers-cover.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@clerk/clerk-js': minor
'@clerk/types': minor
---

Introduce `logoLinkUrl` prop in `appearance.layout`
A new `logoLinkUrl` prop has been added to `appearance.layout` and used in `ApplicationLogo` to change the `href` of the link.
By default, the logo link url will be the Home URL you've set in the Clerk Dashboard.
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ describe('AppearanceProvider layout flows', () => {
layout: {
helpPageUrl: 'test',
logoImageUrl: 'test',
logoLinkUrl: 'test',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikosdouvlis @desiprisg Not related to this PR, but it would be nice to have some actual test URLs here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup makes sense - adding a ticket

privacyPageUrl: 'test',
termsPageUrl: 'test',
logoPlacement: 'inside',
Expand All @@ -249,6 +250,7 @@ describe('AppearanceProvider layout flows', () => {
const { result } = renderHook(() => useAppearance(), { wrapper });
expect(result.current.parsedLayout.helpPageUrl).toBe('test');
expect(result.current.parsedLayout.logoImageUrl).toBe('test');
expect(result.current.parsedLayout.logoLinkUrl).toBe('test');
expect(result.current.parsedLayout.privacyPageUrl).toBe('test');
expect(result.current.parsedLayout.termsPageUrl).toBe('test');
expect(result.current.parsedLayout.logoPlacement).toBe('inside');
Expand All @@ -265,6 +267,7 @@ describe('AppearanceProvider layout flows', () => {
layout: {
helpPageUrl: 'test2',
logoImageUrl: 'test2',
logoLinkUrl: 'test2',
privacyPageUrl: 'test2',
termsPageUrl: 'test2',
logoPlacement: 'outside',
Expand All @@ -281,6 +284,7 @@ describe('AppearanceProvider layout flows', () => {
const { result } = renderHook(() => useAppearance(), { wrapper });
expect(result.current.parsedLayout.helpPageUrl).toBe('test2');
expect(result.current.parsedLayout.logoImageUrl).toBe('test2');
expect(result.current.parsedLayout.logoLinkUrl).toBe('test2');
expect(result.current.parsedLayout.privacyPageUrl).toBe('test2');
expect(result.current.parsedLayout.termsPageUrl).toBe('test2');
expect(result.current.parsedLayout.logoPlacement).toBe('outside');
Expand All @@ -297,6 +301,7 @@ describe('AppearanceProvider layout flows', () => {
layout: {
helpPageUrl: 'test',
logoImageUrl: 'test',
logoLinkUrl: 'test',
privacyPageUrl: 'test',
termsPageUrl: 'test',
logoPlacement: 'inside',
Expand All @@ -309,6 +314,7 @@ describe('AppearanceProvider layout flows', () => {
layout: {
helpPageUrl: 'test2',
logoImageUrl: 'test2',
logoLinkUrl: 'test2',
privacyPageUrl: 'test2',
termsPageUrl: 'test2',
logoPlacement: 'outside',
Expand All @@ -325,6 +331,7 @@ describe('AppearanceProvider layout flows', () => {
const { result } = renderHook(() => useAppearance(), { wrapper });
expect(result.current.parsedLayout.helpPageUrl).toBe('test2');
expect(result.current.parsedLayout.logoImageUrl).toBe('test2');
expect(result.current.parsedLayout.logoLinkUrl).toBe('test2');
expect(result.current.parsedLayout.privacyPageUrl).toBe('test2');
expect(result.current.parsedLayout.termsPageUrl).toBe('test2');
expect(result.current.parsedLayout.logoPlacement).toBe('outside');
Expand Down
1 change: 1 addition & 0 deletions packages/clerk-js/src/ui/customizables/parseAppearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const defaultLayout: ParsedLayout = {
socialButtonsPlacement: 'top',
socialButtonsVariant: 'auto',
logoImageUrl: '',
logoLinkUrl: '',
showOptionalFields: true,
helpPageUrl: '',
privacyPageUrl: '',
Expand Down
3 changes: 2 additions & 1 deletion packages/clerk-js/src/ui/elements/ApplicationLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const ApplicationLogo = (props: ApplicationLogoProps) => {
const { logoImageUrl, applicationName, homeUrl } = useEnvironment().displayConfig;
const { parsedLayout } = useAppearance();
const imageSrc = parsedLayout.logoImageUrl || logoImageUrl;
const logoUrl = parsedLayout.logoLinkUrl || homeUrl;

if (!imageSrc) {
return null;
Expand Down Expand Up @@ -64,7 +65,7 @@ export const ApplicationLogo = (props: ApplicationLogoProps) => {
props.sx,
]}
>
{homeUrl ? <RouterLink to={homeUrl}>{image}</RouterLink> : image}
{logoUrl ? <RouterLink to={logoUrl}>{image}</RouterLink> : image}
</Flex>
);
};
8 changes: 8 additions & 0 deletions packages/types/src/appearance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,14 @@ export type Layout = {
* @default undefined
*/
logoImageUrl?: string;
/**
* Controls where the browser will redirect to after the user clicks the application logo,
* usually found in the SignIn and SignUp components.
* If a URL is provided, it will be used as the `href` of the link.
* If a value is not passed in, the components will use the Home URL as set in the Clerk dashboard
* @default undefined
*/
Comment thread
nikosdouvlis marked this conversation as resolved.
logoLinkUrl?: string;
/**
* Controls the variant that will be used for the social buttons.
* By default, the components will use block buttons if you have less than
Expand Down