Skip to content

Commit 309a512

Browse files
authored
Styling tweaks for external usage (#372)
1 parent 772f535 commit 309a512

File tree

6 files changed

+43
-18
lines changed

6 files changed

+43
-18
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
9+
### Added
10+
- Add CSS custom properties for overriding fonts ([#372](https://github.com/cucumber/react-components/pull/372))
11+
912
### Fixed
1013
- Avoid NaN percentage passed when nothing ran ([#363](https://github.com/cucumber/react-components/pull/363))
1114
- Don't render hook steps with no content ([#361](https://github.com/cucumber/react-components/pull/361))

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ In your CSS for the `acme-widgets` class, you can override the supported [custom
9999
}
100100
```
101101

102+
### Fonts
103+
104+
By default, web-safe default font stacks are used, but you can override these so the components use your preferred fonts. These custom properties are supported:
105+
106+
- `--cucumber-sans-font-family` - the font used for the text
107+
- `--cucumber-mono-font-family` - the font used for doc strings and attachments
108+
102109
### Custom styles
103110

104111
For more control over the styling, you can override the CSS used by individual components.

src/components/app/ExecutionSummary.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
margin: 0;
3636

3737
svg {
38+
display: inline-block;
3839
max-width: 2em;
3940
}
4041
}

src/components/gherkin/Title.module.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,13 @@
44
padding: 0;
55
margin: 0;
66
}
7+
8+
h1.title,
9+
h2.title {
10+
font-size: 1.5em;
11+
}
12+
13+
h3.title,
14+
h4.title {
15+
font-size: 1.125em;
16+
}

src/styles/fonts.scss

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
$defaultSansFamily:
2+
'Inter var',
3+
ui-sans-serif,
4+
system-ui,
5+
-apple-system,
6+
BlinkMacSystemFont,
7+
'Segoe UI',
8+
Roboto,
9+
'Helvetica Neue',
10+
Arial,
11+
'Noto Sans',
12+
sans-serif,
13+
'Apple Color Emoji',
14+
'Segoe UI Emoji',
15+
'Segoe UI Symbol',
16+
'Noto Color Emoji';
17+
$defaultMonoFamily:
18+
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;

src/styles/theming.scss

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
1-
$sansFamily:
2-
'Inter var',
3-
ui-sans-serif,
4-
system-ui,
5-
-apple-system,
6-
BlinkMacSystemFont,
7-
'Segoe UI',
8-
Roboto,
9-
'Helvetica Neue',
10-
Arial,
11-
'Noto Sans',
12-
sans-serif,
13-
'Apple Color Emoji',
14-
'Segoe UI Emoji',
15-
'Segoe UI Symbol',
16-
'Noto Color Emoji';
17-
$monoFamily:
18-
ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
1+
@import './fonts';
2+
3+
$sansFamily: var(--cucumber-sans-font-family, $defaultSansFamily);
4+
$monoFamily: var(--cucumber-mono-font-family, $defaultMonoFamily);
195
$backgroundColor: var(--cucumber-background-color, white);
206
$textColor: var(--cucumber-text-color, #222);
217
$anchorColor: var(--cucumber-anchor-color, #297bde);

0 commit comments

Comments
 (0)