Skip to content

Styling props #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/mdx/src/mdx-client/scrollycoding.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
display: flex;
position: relative;
margin: 1rem 0;
gap: 1rem;
}

.ch-scrollycoding-content {
box-sizing: border-box;
padding-right: 16px;
flex: 1;
}

Expand Down
7 changes: 6 additions & 1 deletion packages/mdx/src/mdx-client/scrollycoding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ export function Scrollycoding({
codeConfig,
presetConfig,
start = 0,
className,
style,
...rest
}: {
children: React.ReactNode
editorSteps: EditorStep[]
codeConfig: EditorProps["codeConfig"]
start?: number
presetConfig?: PresetConfig
className?: string
style?: React.CSSProperties
}) {
const stepsChildren = React.Children.toArray(children)

Expand Down Expand Up @@ -58,7 +62,8 @@ export function Scrollycoding({
<section
className={`ch-scrollycoding ${
presetConfig ? "ch-scrollycoding-with-preview" : ""
}`}
} ${className || ""}`}
style={style}
>
<div className="ch-scrollycoding-content">
<Scroller onStepChange={onStepChange}>
Expand Down
9 changes: 8 additions & 1 deletion packages/mdx/src/mdx-client/section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ const SectionContext = React.createContext<{

export function Section({
children,
className,
style,
...props
}: {
children: React.ReactNode
className?: string
style?: React.CSSProperties
}) {
const [state, setState] = React.useState<any>(props)

Expand All @@ -45,7 +49,10 @@ export function Section({
const { selectedId, ...rest } = state

return (
<section>
<section
className={`ch-section ${className || ""}`}
style={style}
>
<SectionContext.Provider
value={{
props: rest,
Expand Down
7 changes: 6 additions & 1 deletion packages/mdx/src/mdx-client/slideshow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ export function Slideshow({
codeConfig,
presetConfig,
code,
className,
style,
...rest
}: {
children: React.ReactNode
editorSteps: EditorStep[]
codeConfig: EditorProps["codeConfig"]
presetConfig?: PresetConfig
code?: EditorProps["codeConfig"]
className?: string
style?: React.CSSProperties
}) {
const stepsChildren = React.Children.toArray(children)

Expand All @@ -42,7 +46,8 @@ export function Slideshow({
<div
className={`ch-slideshow ${
presetConfig ? "ch-slideshow-with-preview" : ""
}`}
} ${className || ""}`}
style={style}
>
<div className="ch-slideshow-slide">
<InnerCode
Expand Down
3 changes: 1 addition & 2 deletions packages/mdx/src/mdx-client/spotlight.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
.ch-spotlight {
display: flex;
gap: 0.5rem;
gap: 1.1rem;
margin: 1rem 0;
}

.ch-spotlight-tabs {
display: flex;
flex-flow: column;
margin-right: 10px;
flex: 1;
gap: 0.5rem;
align-items: stretch;
Expand Down
11 changes: 8 additions & 3 deletions packages/mdx/src/mdx-client/spotlight.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ export function Spotlight({
codeConfig,
start = 0,
presetConfig,
className,
style,
...rest
}: {
children: React.ReactNode
editorSteps: EditorStep[]
codeConfig: EditorProps["codeConfig"]
start?: number
presetConfig?: PresetConfig
className?: string
style?: React.CSSProperties
}) {
const stepsChildren = React.Children.toArray(children)

Expand All @@ -38,10 +42,11 @@ export function Spotlight({
stepsChildren[0] as React.ReactElement

return (
<div
<section
className={`ch-spotlight ${
presetConfig ? "ch-spotlight-with-preview" : ""
}`}
} ${className || ""}`}
style={style}
>
<div className="ch-spotlight-tabs">
{headerElement?.props?.children ? (
Expand Down Expand Up @@ -83,6 +88,6 @@ export function Spotlight({
/>
)}
</div>
</div>
</section>
)
}
1 change: 1 addition & 0 deletions packages/mdx/src/remark/transform.section.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ async function transformSection(
name: "CH.Section",
props: props as any,
addConfigProp: true,
appendProps: true,
})
} else {
toJSX(node, { name: "div", props: {} })
Expand Down