Skip to content

Commit 78dcb0a

Browse files
committed
Tweak fonts in docs
- Remove `:host` from `src/theme.scss` since all custom properties in component previews are inherited from root. - Remove redundant font requests and resource hints. - Minor component's README fixes.
1 parent 0c201b0 commit 78dcb0a

File tree

7 files changed

+19
-23
lines changed

7 files changed

+19
-23
lines changed

mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ theme:
2828
name: material
2929
language: 'en'
3030
favicon: 'favicon.ico'
31+
font: false
3132
custom_dir: 'src/docs/_overrides'
3233
palette:
3334
- media: "(prefers-color-scheme: light)"
@@ -48,7 +49,7 @@ theme:
4849
extra_css:
4950
- https://unpkg.com/[email protected]/themes/prism-twilight.min.css # Prism JS syntax highlighting
5051
- docs/_assets/stylesheets/extra.css # mkDocs theme tweaks
51-
- docs/_assets/generated/docs-custom-properties.development.css # Load React UI CSS custom properties to make them accessible in the document root (outside shadowDOM) so we can preview colors etc.
52+
- docs/_assets/generated/docs-custom-properties.development.css # Load React UI CSS custom properties to make them accessible in the document root (outside Shadow DOM), so we can set the root font size and preview colors and helpers/utilities.
5253

5354
# Additional JS. Mind the order!
5455
extra_javascript:

src/components/Alert/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ See [API](#api) for all available options.
3232
## Color Variants
3333

3434
To cover all possible needs of your project, Alert is available in colors from
35-
[Feedback and Neutral color collections](/docs/foundation/collections#colors).
35+
[Feedback color collection](/docs/foundation/collections#colors).
3636

3737
### Success
3838

src/components/FormLayout/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ This is a demo of all components supported by FormLayout.
300300

301301
```docoff-react-preview
302302
React.createElement(() => {
303-
const [fieldLayout, setFieldLayout] = React.useState('vertical');
303+
const [fieldLayout, setFieldLayout] = React.useState('horizontal');
304304
const [fruit, setFruit] = React.useState('apple');
305305
const [isDeliveryAddress, setIsDeliveryAddress] = React.useState(true);
306306
const [receiveNewsletter, setReceiveNewsletter] = React.useState(true);
@@ -323,16 +323,16 @@ React.createElement(() => {
323323
<Toolbar>
324324
<ToolbarItem>
325325
<ButtonGroup>
326-
<Button
327-
color={fieldLayout === 'vertical' ? 'selected' : 'secondary'}
328-
label="Vertical layout"
329-
onClick={() => setFieldLayout('vertical')}
330-
/>
331326
<Button
332327
color={fieldLayout === 'horizontal' ? 'selected' : 'secondary'}
333328
label="Horizontal layout"
334329
onClick={() => setFieldLayout('horizontal')}
335330
/>
331+
<Button
332+
color={fieldLayout === 'vertical' ? 'selected' : 'secondary'}
333+
label="Vertical layout"
334+
onClick={() => setFieldLayout('vertical')}
335+
/>
336336
</ButtonGroup>
337337
</ToolbarItem>
338338
</Toolbar>
@@ -388,6 +388,7 @@ React.createElement(() => {
388388
rows={3}
389389
/>
390390
<FileInputField
391+
id="my-file"
391392
label="Attachment"
392393
onFilesChanged={() => {}}
393394
/>

src/components/InputGroup/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ supports this kind of layout as well.
145145
label="Horizontal layout"
146146
layout="horizontal"
147147
>
148-
<FileInputField label="Attachment" onFilesChanged={() => {}} />
148+
<FileInputField id="my-file" label="Attachment" onFilesChanged={() => {}} />
149149
<Button label="Submit" />
150150
</InputGroup>
151151
```

src/docs/_assets/stylesheets/extra.css

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,7 @@
2020
/* stylelint-enable */
2121

2222
--docoff-code-line-height: 1.5;
23-
--docoff-code-font-family:
24-
"SFMono-Regular",
25-
"Menlo",
26-
"Monaco",
27-
"Consolas",
28-
"Liberation Mono",
29-
"Courier New",
30-
monospace;
23+
--docoff-code-font-family: var(--rui-font-family-monospace);
3124

3225
/* Visual configuration of the `<docoff-react-preview>` live preview */
3326
--docoff-preview-border-color: #ced4de;
@@ -76,13 +69,17 @@
7669

7770
/* Document */
7871
html {
79-
font-size: 100%;
72+
/* DO NOT CHANGE THE FONT SIZE. `rem` in docoff previews is calculated from the root font size which is this. */
73+
font-size: var(--rui-font-size-base);
8074
scroll-padding-top: 3.2rem;
8175
scroll-margin-top: 4rem;
8276
}
8377

8478
body {
85-
font-size: 1rem;
79+
--md-text-font-family: var(--rui-font-family-base);
80+
--md-code-font-family: var(--rui-font-family-monospace);
81+
82+
font-size: 1em;
8683
background-color: var(--md-default-bg-color);
8784
}
8885

src/docs/_overrides/main.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22

33
{% block site_meta %}
44
{{ super() }}
5-
<link rel="preconnect" href="https://fonts.googleapis.com" />
6-
<link rel="preconnect" href="https://fonts.gstatic.com" />
75
<link rel="preconnect" href="https://unpkg.com" />
86
{% endblock %}

src/theme.scss

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
@use "styles/theme-constants/svg";
66

77
@layer theme {
8-
:root,
9-
:host {
8+
:root {
109
// ============================================================================================ //
1110
// GLOBAL TOKENS //
1211
// ============================================================================================ //

0 commit comments

Comments
 (0)