Skip to content

Commit 2ee1add

Browse files
committed
Tweak code block styling
1 parent e30ac1c commit 2ee1add

File tree

3 files changed

+43
-3
lines changed

3 files changed

+43
-3
lines changed

src/components/Pre.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ export default function Pre({
282282
target="_blank"
283283
href={url.href}
284284
>
285-
Try this example on Snack{' '}
285+
Try on <b>Snack</b>
286286
<svg
287287
width="14px"
288288
height="14px"

src/css/custom.css

+40
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@
1010
--primary-saturation: 53.2%;
1111
--primary-lightness: 50.2%;
1212

13+
--ifm-font-family-monospace: ui-monospace, SFMono-Regular, Menlo, Monaco,
14+
Consolas, Liberation Mono, Courier New, monospace;
15+
--ifm-font-family-base: ui-sans-serif, system-ui, -apple-system,
16+
BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, Noto Sans,
17+
sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol,
18+
Noto Color Emoji;
19+
20+
--ifm-code-font-size: 85%;
21+
1322
--ifm-color-primary: hsl(
1423
var(--primary-hue),
1524
var(--primary-saturation),
@@ -192,12 +201,43 @@ samp {
192201
display: none;
193202
}
194203

204+
.theme-code-block:has(+ .snack-sample-link) {
205+
margin-bottom: 0;
206+
border-bottom-left-radius: 0;
207+
border-bottom-right-radius: 0;
208+
}
209+
210+
.theme-code-block + .snack-sample-link {
211+
display: block;
212+
font-size: var(--ifm-code-font-size);
213+
text-align: right;
214+
margin-top: 0;
215+
margin-bottom: var(--ifm-leading);
216+
padding: calc(var(--ifm-pre-padding) / 2) var(--ifm-pre-padding);
217+
background-color: #f6f8fa;
218+
border-top-width: 1px;
219+
border-top-style: solid;
220+
border-top-color: var(--ifm-color-gray-200);
221+
border-bottom-left-radius: var(--ifm-pre-border-radius);
222+
border-bottom-right-radius: var(--ifm-pre-border-radius);
223+
box-shadow: var(--ifm-global-shadow-lw);
224+
}
225+
226+
[data-theme='dark'] .theme-code-block + .snack-sample-link {
227+
background-color: #282a35;
228+
border-top-color: rgba(255, 255, 255, 0.07);
229+
}
230+
195231
.snack-sample-link {
196232
display: block;
197233
margin-bottom: 25px;
198234
margin-top: -8px;
199235
}
200236

237+
.snack-sample-link svg {
238+
margin-left: 8px;
239+
}
240+
201241
/**
202242
* use magic comments to mark diff blocks
203243
*/

static/js/snack-helpers.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ function appendSnackLink() {
155155
link.target = '_blank';
156156

157157
if (label) {
158-
link.innerHTML = `Try the "${label}" example on Snack ${openIcon}`;
158+
link.innerHTML = `Try the "${label}" example on <b>Snack</b>${openIcon}`;
159159
} else {
160-
link.innerHTML = `Try this example on Snack ${openIcon}`;
160+
link.innerHTML = `Try this example on <b>Snack</b>${openIcon}`;
161161
}
162162

163163
// Add the href and append the link element if we have some code

0 commit comments

Comments
 (0)