feat: turn off code-blocks wrapping

Can enable using `typography.code.wrap` theme option, fixes #658
This commit is contained in:
Roman Hotsiy 2018-10-05 15:10:20 +03:00
parent f39fc98eab
commit 393681b99e
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
4 changed files with 5 additions and 4 deletions

View File

@ -8,7 +8,7 @@ export const jsonStyles = css`
font-family: ${props => props.theme.typography.code.fontFamily}; font-family: ${props => props.theme.typography.code.fontFamily};
font-size: ${props => props.theme.typography.code.fontSize}; 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; overflow-x: auto;
.callback-function { .callback-function {

View File

@ -74,7 +74,7 @@ export const StyledMarkdownBlock = withProps<{ compact?: boolean; inline?: boole
pre { pre {
font-family: ${props => props.theme.typography.code.fontFamily}; 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; background-color: #263238;
color: white; color: white;
padding: 12px 14px 15px 14px; padding: 12px 14px 15px 14px;

View File

@ -12,7 +12,7 @@ const StyledPre = styled(PrismDiv.withComponent('pre'))`
overflow-x: auto; overflow-x: auto;
margin: 0; margin: 0;
white-space: pre-wrap; white-space: ${({ theme }) => (theme.typography.code.wrap ? 'pre-wrap' : 'pre')};
`; `;
export interface SourceCodeProps { export interface SourceCodeProps {

View File

@ -102,7 +102,6 @@ const defaultTheme: ThemeInterface = {
fontFamily: 'Roboto, sans-serif', fontFamily: 'Roboto, sans-serif',
smoothing: 'antialiased', smoothing: 'antialiased',
optimizeSpeed: true, optimizeSpeed: true,
headings: { headings: {
fontFamily: 'Montserrat, sans-serif', fontFamily: 'Montserrat, sans-serif',
}, },
@ -113,6 +112,7 @@ const defaultTheme: ThemeInterface = {
fontWeight: ({ typography }) => typography.fontWeightRegular, fontWeight: ({ typography }) => typography.fontWeightRegular,
color: '#e53935', color: '#e53935',
backgroundColor: 'rgba(38, 50, 56, 0.04)', backgroundColor: 'rgba(38, 50, 56, 0.04)',
wrap: false,
}, },
links: { links: {
color: ({ colors }) => colors.primary.main, color: ({ colors }) => colors.primary.main,
@ -271,6 +271,7 @@ export interface ResolvedThemeInterface {
code: FontSettings & { code: FontSettings & {
backgroundColor: string; backgroundColor: string;
wrap: boolean;
}; };
headings: { headings: {
fontFamily: string; fontFamily: string;