Skip to content

Commit 3e29353

Browse files
hawkgspkozlowski-opensource
authored andcommitted
docs(docs-infra): use a custom scrollbar for the examples using HighlightTypeScript (angular#60981)
The examples used to render the native scrollbar. PR Close angular#60981
1 parent fd8f5c6 commit 3e29353

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

adev/shared-docs/pipeline/api-gen/rendering/templates/highlight-ts.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import {RawHtml} from './raw-html';
1111
import {codeToHtml} from '../shiki/shiki';
1212

1313
/** Component to render a header of the CLI page. */
14-
export function HighlightTypeScript(props: {code: string; }) {
14+
export function HighlightTypeScript(props: {code: string}) {
1515
const result = codeToHtml(props.code, 'typescript');
16+
const withScrollTrack = result.replace(/^(<pre class="shiki)/, '$1 docs-mini-scroll-track');
1617

17-
return <RawHtml value={result} />;
18+
return <RawHtml value={withScrollTrack} />;
1819
}

adev/shared-docs/pipeline/api-gen/rendering/templates/raw-html.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
import {h} from 'preact';
1010

1111
/** Convenience component to render raw html */
12-
export function RawHtml(props: {value: string, className?: string}) {
12+
export function RawHtml(props: {value: string; className?: string}) {
1313
// Unfortunately, there does not seem to be a way to render the raw html
1414
// into a text node without introducing a div.
15-
return <div className={props.className} dangerouslySetInnerHTML={({__html: props.value})}></div>;
15+
return <div className={props.className} dangerouslySetInnerHTML={{__html: props.value}}></div>;
1616
}

adev/shared-docs/styles/_colors.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@
290290
// LIGHT MODE (Explicit)
291291
.docs-light-mode {
292292
background-color: #ffffff;
293+
color-scheme: light;
293294
@include root-definitions();
294295
.docs-invert-mode {
295296
@include dark-mode-definitions();
@@ -299,6 +300,7 @@
299300
// DARK MODE (Explicit)
300301
.docs-dark-mode {
301302
background-color: oklch(16.93% 0.004 285.95);
303+
color-scheme: dark;
302304
@include root-definitions();
303305
@include dark-mode-definitions();
304306
.docs-invert-mode {

adev/shared-docs/styles/_reference.scss

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,11 @@
140140

141141
code {
142142
font-size: 0.875rem;
143+
overflow: hidden;
143144

144145
&:has(pre) {
145146
padding: 0;
146147
}
147-
148-
&:not(pre *) {
149-
padding: 0 0.3rem;
150-
}
151148
}
152149

153150
pre {

0 commit comments

Comments
 (0)