Skip to content

Commit c7cd6ea

Browse files
committed
Wrap codeblocks and codegroups
1 parent 7b3a2f1 commit c7cd6ea

File tree

7 files changed

+39
-15
lines changed

7 files changed

+39
-15
lines changed

packages/mdx/src/client/code.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,23 @@ export function InnerCode({
2929
!props.files[0].name
3030
) {
3131
return (
32-
<CodeSpring
33-
className="ch-code"
34-
config={props.codeConfig}
35-
step={props.files[0]}
36-
/>
32+
<div className="ch-codeblock no-prose">
33+
<CodeSpring
34+
className="ch-code"
35+
config={props.codeConfig}
36+
step={props.files[0]}
37+
/>
38+
</div>
3739
)
3840
} else {
3941
const frameProps = {
4042
...props?.frameProps,
4143
onTabClick,
4244
}
4345
return (
44-
<EditorSpring {...props} frameProps={frameProps} />
46+
<div className="ch-codegroup no-prose">
47+
<EditorSpring {...props} frameProps={frameProps} />
48+
</div>
4549
)
4650
}
4751
}

packages/mdx/src/client/slideshow.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
aspect-ratio: 16 / 9;
1111
}
1212

13-
.ch-slideshow-slide .ch-editor-frame,
14-
.ch-slideshow-slide .ch-code {
13+
.ch-slideshow-slide .ch-codegroup,
14+
.ch-slideshow-slide .ch-codeblock {
1515
flex: 2;
1616
}
1717

packages/mdx/src/client/spotlight.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
max-height: 80vh;
4242
}
4343

44-
.ch-spotlight-sticker .ch-editor-frame,
45-
.ch-spotlight-sticker .ch-code {
44+
.ch-spotlight-sticker .ch-codegroup,
45+
.ch-spotlight-sticker .ch-codeblock {
4646
width: 100%;
4747
min-width: 100%;
4848
min-height: Min(100%, 80vh);
@@ -56,8 +56,8 @@
5656
gap: 0.5rem;
5757
}
5858

59-
.ch-spotlight-sticker .ch-editor-frame,
60-
.ch-spotlight-sticker .ch-code {
59+
.ch-spotlight-sticker .ch-codegroup,
60+
.ch-spotlight-sticker .ch-codeblock {
6161
min-height: 0;
6262
flex: 1;
6363
}

packages/mdx/src/index.scss

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@
44
@import "./client/scrollycoding.scss";
55
@import "./client/slideshow.scss";
66

7-
.ch-code {
7+
.ch-codeblock,
8+
.ch-codegroup {
89
border-radius: 6px;
10+
overflow: hidden;
11+
box-shadow: 0 13px 27px -5px rgba(50, 50, 93, 0.25),
12+
0 8px 16px -8px rgba(0, 0, 0, 0.3),
13+
0 -6px 16px -6px rgba(0, 0, 0, 0.025);
14+
}
15+
16+
.ch-codeblock > *,
17+
.ch-codegroup > * {
18+
height: 100%;
919
}

packages/mini-editor/src/editor-frame.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export const EditorFrame = React.forwardRef<
6363
<div
6464
ref={ref}
6565
{...rest}
66-
className="ch-frame ch-editor-frame"
66+
className="ch-editor-frame"
6767
style={{
6868
background: getColor(
6969
theme,

packages/mini-editor/src/index.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
flex-direction: column;
4646
position: relative;
4747
overflow: hidden;
48+
font-family: Ubuntu, Droid Sans, -apple-system,
49+
BlinkMacSystemFont, Segoe WPC, Segoe UI, sans-serif;
50+
break-inside: avoid;
51+
--ch-title-bar-height: 30px;
52+
height: 100%;
4853
}
4954

5055
.ch-editor-frame .ch-frame-title-bar {

packages/smooth-code/src/code-tween.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,12 @@ function Wrapper({
168168
return (
169169
<pre
170170
{...htmlProps}
171-
style={{ margin: 0, padding: 0, ...style, ...htmlProps?.style }}
171+
style={{
172+
margin: 0,
173+
padding: 0,
174+
...style,
175+
...htmlProps?.style,
176+
}}
172177
children={children}
173178
/>
174179
)

0 commit comments

Comments
 (0)