Skip to content

Commit

Permalink
Using multiple fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
thieryw committed Dec 9, 2021
1 parent 60da649 commit 7a2003d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
4 changes: 4 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
<link href="https://fonts.googleapis.com/css2?family=Work+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
-->

<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">

</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
32 changes: 28 additions & 4 deletions src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
import { createThemeProvider, defaultGetTypographyDesc } from "onyxia-ui";

export const { ThemeProvider, useTheme } = createThemeProvider({
"getTypographyDesc": params => ({
...defaultGetTypographyDesc(params),
"fontFamily": '"Work Sans", sans-serif'
})
"getTypographyDesc": ({
browserFontSizeFactor,
windowInnerHeight,
windowInnerWidth
}) => {

const typographyDesc = defaultGetTypographyDesc({
browserFontSizeFactor,
windowInnerHeight,
windowInnerWidth
})

return {
"fontFamily": '"Work Sans", sans-serif',
"rootFontSizePx": typographyDesc.rootFontSizePx,
"variants": {
...typographyDesc.variants,
"page heading": {
...typographyDesc.variants["page heading"],
"fontFamily": '"Playfair Display", serif'
},
"subtitle": {
...typographyDesc.variants["subtitle"],
"fontFamily": '"Open Sans", sans-serif'
}
}
}
}
});

0 comments on commit 7a2003d

Please sign in to comment.