{({ className, style, tokens, getLineProps, getTokenProps }) => {
if (collapsedState) {
style.height = '1.95rem';
style.padding = '0.3rem 0.2rem 0.4rem 0';
style.overflow = 'hidden';
}
style.transition = 'height: 1s, padding: 1s';
return (
{title && (
{title}
)}
{tokens.map((line, i) => (
{showNumbers ? {i + 1} : <> >}
{line.map((token, key) => (
))}
))}
);
}}
>
);
};
export default Code;
export const Wrapper = styled.div`
font-family: sans-serif;
text-align: center;
`;
export const Pre = styled.pre`
text-align: left;
margin: 1em 0;
padding: 0.5em;
overflow: scroll;
& .token-line {
line-height: 1.5em;
height: 1.5em;
}
`;
export const Line = styled.div`
display: table-row;
`;
export const LineNo = styled.span`
display: table-cell;
text-align: right;
padding-right: 1em;
user-select: none;
opacity: 0.5;
`;
export const LineContent = styled.span`
display: table-cell;
`;