Skip to content

Commit

Permalink
[@mantine/core] TypographyStylesProvider: Fix code tag styles when it…
Browse files Browse the repository at this point in the history
… is nested within pre tag (#2219)
  • Loading branch information
rtivital committed Aug 27, 2022
1 parent ae47009 commit cf8660f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
@@ -0,0 +1,22 @@
import React from 'react';
import { TypographyStylesProvider } from './TypographyStylesProvider';

export default { title: 'TypographyStylesProvider' };

const content = `
<pre><code>{
"firstName": "John",
"lastName": "Smith",
"age": 25
}</code></pre>
`;

export function CodeBlock() {
return (
<div style={{ padding: 40 }}>
<TypographyStylesProvider>
<div dangerouslySetInnerHTML={{ __html: content }} />
</TypographyStylesProvider>
</div>
);
}
Expand Up @@ -87,6 +87,14 @@ export default createStyles((theme) => {
fontSize: theme.fontSizes.sm,
borderRadius: theme.radius.sm,
backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[8] : theme.colors.gray[0],

'& code': {
backgroundColor: 'transparent',
padding: 0,
borderRadius: 0,
color: 'inherit',
border: 0,
},
},

'& code': {
Expand Down

0 comments on commit cf8660f

Please sign in to comment.