Skip to content

Commit

Permalink
Merge pull request #18158 from storybookjs/fix-syntax-highlighter
Browse files Browse the repository at this point in the history
Components: Fix race conditions in SyntaxHighlighter
  • Loading branch information
shilman authored May 6, 2022
2 parents 553f732 + ca24412 commit b988892
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/components/src/syntaxhighlighter/syntaxhighlighter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ const Scroller = styled(({ children, className }) => (
{
position: 'relative',
},
({ theme }) => ({
'& code': {
paddingRight: theme.layoutMargin,
},
}),
({ theme }) => themedSyntax(theme)
);

Expand All @@ -121,11 +116,16 @@ const Pre = styled.pre<PreProps>(({ theme, padded }) => ({
padding: padded ? theme.layoutMargin : 0,
}));

const Code = styled.code({
/*
We can't use `code` since PrismJS races for it.
See https://github.com/storybookjs/storybook/issues/18090
*/
const Code = styled.div(({ theme }) => ({
flex: 1,
paddingRight: 0,
paddingLeft: 2, // TODO: To match theming/global.ts for now
paddingRight: theme.layoutMargin,
opacity: 1,
});
}));

export interface SyntaxHighlighterState {
copied: boolean;
Expand Down

0 comments on commit b988892

Please sign in to comment.