Skip to content

Instantly share code, notes, and snippets.

@zaydek-old
Created December 26, 2019 21:09
Show Gist options
  • Save zaydek-old/82257539d6d929a1f304648892724948 to your computer and use it in GitHub Desktop.
Save zaydek-old/82257539d6d929a1f304648892724948 to your computer and use it in GitHub Desktop.
// Compound component.
//
// https://codepen.io/zaydek/pen/PowjgOg
const CodeBlock = props => (
<div style={stylex.parse("p-y:16 b:gray-100 br:8 overflow -x:scroll")}>
{props.children.map((each, index) => (
<code key={each.key} style={{ ...stylex.parse("p-x:16 inline-block"), minWidth: "100%", ...codeLineStyle }}>
<Syntax
start={!index && props.open}
end={index + 1 === props.children.length && "```"}
>
{each.data || (
index > 0 && index + 1 < props.children.length && (
<br />
)
)}
</Syntax>
</code>
))}
</div>
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment