-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add regular and monospace font (#102)
<!-- Is your PR related to an issue? Then please link it via the "closes #" below. Else, remove it. --> ## Description Add CSS variables `--onyx-font-family` and `--onyx-font-family-mono`. Also update docs on how to install the font families since we should not directly bundle them with Onyx because the project should be able to use different fonts.
- Loading branch information
1 parent
13f96c1
commit 0920aa6
Showing
10 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"sit-onyx": minor | ||
--- | ||
|
||
feat: add CSS variables `--onyx-font-family` and `--onyx-font-family-mono` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Typography | ||
|
||
The Onyx design system relies on a default (sans-serif) and a monospace font family. | ||
|
||
Onyx is intended to be used with the following font families which are open-source | ||
and free to use under the [SIL Open Font License](https://en.wikipedia.org/wiki/SIL_Open_Font_License): | ||
|
||
- Default: [Source Sans 3](https://fontsource.org/fonts/source-sans-3) | ||
- Monospace: [Source Code Pro](https://fontsource.org/fonts/source-code-pro) | ||
|
||
## Using custom font families | ||
|
||
::: info Default font families | ||
The above default font families are already bundled into the component library | ||
so you don't need to install them manually. | ||
::: | ||
|
||
If you want to use custom font families, you need to install them and override the following CSS variables manually. | ||
|
||
We recommend installing font families as npm package using [Fontsource](https://fontsource.org). | ||
|
||
::: code-group | ||
|
||
```css [custom.css] | ||
/* import your custom fonts here... */ | ||
:root { | ||
--onyx-font-family: "My custom font family", sans-serif; | ||
--onyx-font-family-mono: "My custom mono font family", monospace; | ||
} | ||
``` | ||
|
||
```ts [main.ts] | ||
// make sure to import your custom styles AFTER "sit-onyx/style.css" | ||
import "custom.css"; | ||
``` | ||
|
||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
-744 Bytes
(84%)
packages/sit-onyx/playwright/snapshots/TestInput/default-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-583 Bytes
(89%)
packages/sit-onyx/playwright/snapshots/TestInput/default-firefox-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-313 Bytes
(92%)
packages/sit-onyx/playwright/snapshots/TestInput/default-webkit-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
// global styles | ||
// global component styles | ||
// DO NOT ADD ANY STYLES HERE THAT HAVE SIDE EFFECTS ON THE GLOBAL APPLICATION (e.g. body, <a> etc.) | ||
@use "@fontsource-variable/source-code-pro"; | ||
@use "@fontsource-variable/source-sans-3"; | ||
|
||
:root { | ||
--onyx-font-family: "Source Sans 3 Variable", sans-serif; | ||
--onyx-font-family-mono: "Source Code Pro Variable", monospace; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.