Created
December 26, 2019 21:09
-
-
Save zaydek-old/82257539d6d929a1f304648892724948 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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