Skip to content

Commit a7a5ea3

Browse files
authored
refactor: make code block shadows consistent with new admonitions (#5215)
1 parent 083037d commit a7a5ea3

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

packages/docusaurus-theme-classic/src/theme/CodeBlock/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,7 @@ export default function CodeBlock({
210210
<pre
211211
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
212212
tabIndex={0}
213-
className={clsx(className, styles.codeBlock, 'thin-scrollbar', {
214-
[styles.codeBlockWithTitle]: codeBlockTitle,
215-
})}
213+
className={clsx(className, styles.codeBlock, 'thin-scrollbar')}
216214
style={style}>
217215
<code className={styles.codeBlockLines}>
218216
{tokens.map((line, i) => {

packages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
.codeBlockContainer {
99
margin-bottom: var(--ifm-leading);
10+
border-radius: var(--ifm-global-radius);
11+
box-shadow: var(--ifm-global-shadow-lw);
12+
overflow: hidden;
1013
}
1114

1215
.codeBlockContent {
@@ -16,21 +19,16 @@
1619
}
1720

1821
.codeBlockTitle {
19-
border-top-left-radius: var(--ifm-global-radius);
20-
border-top-right-radius: var(--ifm-global-radius);
2122
border-bottom: 1px solid var(--ifm-color-emphasis-300);
2223
font-size: var(--ifm-code-font-size);
2324
font-weight: 500;
2425
padding: 0.75rem var(--ifm-pre-padding);
2526
}
2627

2728
.codeBlock {
29+
margin: 0;
2830
padding: 0;
29-
}
30-
31-
.codeBlockWithTitle {
32-
border-top-left-radius: 0;
33-
border-top-right-radius: 0;
31+
border-radius: 0;
3432
}
3533

3634
.copyButton {

packages/docusaurus-theme-live-codeblock/src/theme/Playground/styles.module.css

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
.playgroundContainer {
99
margin-bottom: var(--ifm-leading);
10+
border-radius: var(--ifm-global-radius);
11+
box-shadow: var(--ifm-global-shadow-lw);
12+
overflow: hidden;
1013
}
1114

1215
.playgroundHeader {
@@ -22,8 +25,6 @@
2225
.playgroundHeader:first-of-type {
2326
background: var(--ifm-color-emphasis-600);
2427
color: var(--ifm-color-content-inverse);
25-
border-top-left-radius: var(--ifm-global-radius);
26-
border-top-right-radius: var(--ifm-global-radius);
2728
}
2829

2930
.playgroundEditor {
@@ -34,11 +35,6 @@
3435
}
3536

3637
.playgroundPreview {
37-
border: 1px solid var(--ifm-color-emphasis-200);
3838
padding: 1rem;
39-
}
40-
41-
.playgroundPreview:last-of-type, .playgroundEditor:last-of-type {
42-
border-bottom-left-radius: var(--ifm-global-radius);
43-
border-bottom-right-radius: var(--ifm-global-radius);
39+
background-color: var(--ifm-pre-background);
4440
}

0 commit comments

Comments
 (0)