Skip to content

Commit

Permalink
Merge pull request #90 from storybookjs/fix-highlight-wrapping
Browse files Browse the repository at this point in the history
Fix wrapping, overflow on Highlight component
  • Loading branch information
kylesuss authored Oct 8, 2019
2 parents 45e1941 + 4f8a235 commit 926f34f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/Highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ const HighlightBlock = styled.div`
color: ${color.darkest};
}
code {
white-space: pre;
}
pre {
padding: 11px 1rem;
margin: 1rem 0;
background: ${color.lighter};
overflow: auto;
}
.language-bash .token.operator,
Expand Down
10 changes: 10 additions & 0 deletions src/components/Highlight.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ export const json = () => (
</>
);

const SmallContainer = styled.div`
max-width: 300px;
`;

export const wrapping = () => (
<SmallContainer>
<Highlight language="javascript">{javascriptCode}</Highlight>
</SmallContainer>
);

const StyledHighlight = styled(Highlight)`
code,
pre {
Expand Down

0 comments on commit 926f34f

Please sign in to comment.