Skip to content

Commit

Permalink
Include CSS Custom Property for mono font family (#4028)
Browse files Browse the repository at this point in the history
* Include CSS Custom Property for mono font family

* Extends pull request #4028: Use a CSS variable for the monospace font stack

* chore(test): update snapshots

---------

Co-authored-by: Josh Black <joshblack@users.noreply.github.com>
  • Loading branch information
joshblack and joshblack authored Dec 19, 2023
1 parent 310c901 commit bbe58b8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .changeset/use-css-variable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
"@primer/react": minor
---
Use a CSS variable for the monospace font stack
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`BranchName renders consistently 1`] = `
display: inline-block;
padding: 2px 6px;
font-size: 12px;
font-family: SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
font-family: var(--fontStack-monospace),SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
color: #0969da;
background-color: #ddf4ff;
border-radius: 6px;
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/TextInput.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1333,7 +1333,7 @@ exports[`TextInput renders monospace 1`] = `
align-items: stretch;
min-height: 32px;
overflow: hidden;
font-family: SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
font-family: var(--fontStack-monospace),SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
}
.c0 input,
Expand Down
10 changes: 9 additions & 1 deletion src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ const fonts = {
'Apple Color Emoji',
'Segoe UI Emoji',
]),
mono: fontStack(['SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', 'Courier', 'monospace']),
mono: fontStack([
'var(--fontStack-monospace)',
'SFMono-Regular',
'Consolas',
'Liberation Mono',
'Menlo',
'Courier',
'monospace',
]),
}

const fontWeights = {
Expand Down

0 comments on commit bbe58b8

Please sign in to comment.