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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ https://<your keycloak url>/realms/<your realm>/account?referrer={encodeURICompo

Otherwise the themes will render in dark mode if the user prefers it.
You can also prevent the login theme (not supported with the account theme) to ever render in dark mode
by disabling "dark mode" in the Keycloak Admin Console in the `Realm Configuration` -> `Themes` section.
by disabling "dark mode" in the Keycloak Admin Console in the `Realm Configuration` -> `Themes` section.
If the "Dark Mode" option is disabled there, the "display setting" selector in the footer will no longer be displayed.

# License

Expand Down
1 change: 1 addition & 0 deletions src/account/KcContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { KcEnvName, ThemeName } from "../kc.gen";
export type KcContextExtension = {
themeName: ThemeName;
properties: Record<KcEnvName, string> & {};
darkMode?: boolean;
};

export type KcContextExtensionPerPage = {};
Expand Down
3 changes: 2 additions & 1 deletion src/account/KcPageStory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const kcContextExtension: KcContextExtension = {
themeName: themeNames[0],
properties: {
...kcEnvDefaults
}
},
darkMode: true
};
const kcContextExtensionPerPage: KcContextExtensionPerPage = {};

Expand Down
2 changes: 1 addition & 1 deletion src/account/Template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
</div>
</div>

<DsfrFooter accessibility="fully compliant" bottomItems={[headerFooterDisplayItem]} />
<DsfrFooter accessibility="fully compliant" bottomItems={[kcContext.darkMode ? headerFooterDisplayItem : undefined]} />
</div>
);
}
10 changes: 9 additions & 1 deletion src/account/pages/Account.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,15 @@ export default meta;
type Story = StoryObj<typeof meta>;

export const Default: Story = {
render: () => <KcPageStory />
render: () => <KcPageStory />
};

export const DefaultDarkModeDisabled: Story = {
render: () => <KcPageStory
kcContext={{
darkMode: false
}}
/>
};

/**
Expand Down
3 changes: 2 additions & 1 deletion src/login/KcPageStory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const kcContextExtension: KcContextExtension = {
},
client: {
baseUrl: "https://my-theme.keycloakify.dev"
}
},
darkMode: true
};
const kcContextExtensionPerPage: KcContextExtensionPerPage = {};

Expand Down
2 changes: 1 addition & 1 deletion src/login/Template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export default function Template(props: Props) {
</div>
</div>
</main>
<DSFRFooter accessibility="fully compliant" bottomItems={[headerFooterDisplayItem]} />
<DSFRFooter accessibility="fully compliant" bottomItems={[kcContext.darkMode ? headerFooterDisplayItem : undefined]} />
</div>
);
}
8 changes: 8 additions & 0 deletions src/login/pages/Login.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export const Default: Story = {
render: () => <KcPageStory />
};

export const DefaultDarkModeDisabled: Story = {
render: () => <KcPageStory
kcContext={{
darkMode: false
}}
/>
};

export const WithInvalidCredential: Story = {
render: () => (
<KcPageStory
Expand Down