Skip to content

Commit

Permalink
feat: turn off code-blocks wrapping
Browse files Browse the repository at this point in the history
Can enable using `typography.code.wrap` theme option, fixes #658
  • Loading branch information
RomanHotsiy committed Oct 5, 2018
1 parent f39fc98 commit 393681b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/JsonViewer/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const jsonStyles = css`
font-family: ${props => props.theme.typography.code.fontFamily};
font-size: ${props => props.theme.typography.code.fontSize};
white-space: pre-wrap;
white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
overflow-x: auto;
.callback-function {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Markdown/styled.elements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const StyledMarkdownBlock = withProps<{ compact?: boolean; inline?: boole
pre {
font-family: ${props => props.theme.typography.code.fontFamily};
white-space: pre-wrap;
white-space:${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
background-color: #263238;
color: white;
padding: 12px 14px 15px 14px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/SourceCode/SourceCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const StyledPre = styled(PrismDiv.withComponent('pre'))`
overflow-x: auto;
margin: 0;
white-space: pre-wrap;
white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
`;

export interface SourceCodeProps {
Expand Down
3 changes: 2 additions & 1 deletion src/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ const defaultTheme: ThemeInterface = {
fontFamily: 'Roboto, sans-serif',
smoothing: 'antialiased',
optimizeSpeed: true,

headings: {
fontFamily: 'Montserrat, sans-serif',
},
Expand All @@ -113,6 +112,7 @@ const defaultTheme: ThemeInterface = {
fontWeight: ({ typography }) => typography.fontWeightRegular,
color: '#e53935',
backgroundColor: 'rgba(38, 50, 56, 0.04)',
wrap: false,
},
links: {
color: ({ colors }) => colors.primary.main,
Expand Down Expand Up @@ -271,6 +271,7 @@ export interface ResolvedThemeInterface {

code: FontSettings & {
backgroundColor: string;
wrap: boolean;
};
headings: {
fontFamily: string;
Expand Down

0 comments on commit 393681b

Please sign in to comment.