Skip to content

Commit

Permalink
Show how to import custom fonts in Storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Nov 2, 2023
1 parent 23a71f8 commit bb019e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/keycloak-theme/login/Template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,12 @@ export default function Template(props: TemplateProps<KcContext, I18n>) {
return (
<div className={getClassName("kcLoginClass")}>
<div id="kc-header" className={getClassName("kcHeaderClass")}>
<div id="kc-header-wrapper" className={getClassName("kcHeaderWrapperClass")}>
{msg("loginTitleHtml", realm.displayNameHtml)}
<div
id="kc-header-wrapper"
className={getClassName("kcHeaderWrapperClass")}
style={{ "fontFamily": '"Work Sans"' }}
>
{msg("loginTitleHtml", realm.displayNameHtml)}!!!
</div>
</div>

Expand Down
8 changes: 7 additions & 1 deletion src/keycloak-theme/login/createPageStory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ export function createPageStory<PageId extends KcContext["pageId"]>(params: {
storyPartialKcContext: params.kcContext
});

return <KcApp kcContext={kcContext} />;
return (
<>
{/* If you import custom fonts in your index.html you have to import them in storybook as well*/}
<link rel="stylesheet" type="text/css" href="fonts/WorkSans/font.css" />
<KcApp kcContext={kcContext} />
</>
);

}

Expand Down

0 comments on commit bb019e6

Please sign in to comment.