Skip to content

Commit 5bc84cd

Browse files
committed
Add some css vars
1 parent 8588dfb commit 5bc84cd

File tree

8 files changed

+25
-15
lines changed

8 files changed

+25
-15
lines changed

packages/mdx/src/client/scrollycoding.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
}
66

77
.ch-scrollycoding-content {
8-
width: 50%;
98
box-sizing: border-box;
109
padding-right: 16px;
10+
flex: 1;
1111
}
1212

1313
.ch-scrollycoding-step-content {
@@ -39,7 +39,7 @@
3939
align-self: start;
4040
flex-flow: column;
4141
justify-content: center;
42-
width: 420px;
42+
width: var(--ch-scrollycoding-sticker-width, 420px);
4343
// capitalized Min to avoid usint the sass min
4444
// min-height: Min(100%, 80vh);
4545
max-height: 80vh;
@@ -66,7 +66,10 @@
6666
.ch-codegroup {
6767
width: 100%;
6868
min-width: 100%;
69-
min-height: 200px;
69+
min-height: var(
70+
--ch-scrollycoding-code-min-height,
71+
200px
72+
);
7073
max-height: 80vh;
7174
margin-top: 0;
7275
margin-bottom: 0;

packages/mdx/src/index.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
& > * {
1717
height: 100%;
18+
max-height: inherit;
19+
min-height: inherit;
1820
}
1921
}
2022

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ export const EditorFrame = React.forwardRef<
5757
},
5858
ref
5959
) {
60-
const c = useClasser("ch-editor")
61-
6260
return (
6361
<div
6462
ref={ref}

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
import { TerminalPanel } from "./terminal-panel"
77
import { useTransition, EditorStep } from "./editor-shift"
88
import { CodeConfig } from "@code-hike/smooth-code"
9+
import { useLayoutEffect } from "@code-hike/utils"
910

1011
export {
1112
EditorTransition,
@@ -14,11 +15,6 @@ export {
1415
EditorTweenProps,
1516
}
1617

17-
const useLayoutEffect =
18-
typeof window !== "undefined"
19-
? React.useLayoutEffect
20-
: React.useEffect
21-
2218
type EditorTransitionProps = {
2319
prev?: EditorStep
2420
next?: EditorStep

packages/playground/styles.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ div#__next > div {
1010
flex-direction: column;
1111
font-family: sans-serif;
1212
background-color: #444;
13+
/* --ch-scrollycoding-code-min-height: 500px;
14+
--ch-scrollycoding-sticker-width: 500px; */
1315
}
1416

1517
nav {

packages/smooth-code/src/use-dimensions.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
FocusString,
44
getFocusIndexes,
55
Tween,
6+
useLayoutEffect,
67
} from "@code-hike/utils"
78

89
type Dimensions = {
@@ -16,11 +17,6 @@ type Dimensions = {
1617
lineNumberWidth: number
1718
} | null
1819

19-
const useLayoutEffect =
20-
typeof window !== "undefined"
21-
? React.useLayoutEffect
22-
: React.useEffect
23-
2420
export { useDimensions, Dimensions }
2521

2622
const DEFAULT_WIDTH = 200

packages/utils/src/hooks.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from "react"
2+
3+
export const useLayoutEffect =
4+
typeof window !== "undefined"
5+
? React.useLayoutEffect
6+
: React.useEffect
7+
8+
// for debugging:
9+
// export const useLayoutEffect = (
10+
// effect: any,
11+
// deps?: any
12+
// ) => {}

packages/utils/src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from "./tween"
22
export * from "./code"
33
export * from "./focus"
44
export * from "./theme"
5+
export * from "./hooks"

0 commit comments

Comments
 (0)