fix(code_block): make sure the background is set on overflowing container instead of children
+ 9
- 12
app/components/Code.tsx
@@ -38,12 +38,9 @@ export const Code: VFC<CodeProps & WithThemeSchemeProp> = ({
     <StylePreTag
       data-language={language}
       className={` language-${language} line-numbers`}
+      themeScheme={themeScheme}
     >
-      <StyledCodeTag
-        {...props}
-        dangerouslySetInnerHTML={innerHtml}
-        themeScheme={themeScheme}
-      />
+      <StyledCodeTag {...props} dangerouslySetInnerHTML={innerHtml} />
     </StylePreTag>
   );
 };

...
@@ -55,16 +52,21 @@ export const getThemedCodeCss = (themeScheme: AppThemeScheme): JSX.Element =>
     <style>{`code[class*=language-],pre[class*=language-]{color:#fff;background:0 0;text-shadow:0 -.1em .2em #000;font-family:Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace;font-size:1em;text-align:left;white-space:pre;word-spacing:normal;word-break:normal;word-wrap:normal;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}@media print{code[class*=language-],pre[class*=language-]{text-shadow:none}}:not(pre)>code[class*=language-],pre[class*=language-]{background:#4c3f33}pre[class*=language-]{padding:1em;margin:.5em 0;overflow:auto;border:.3em solid #7a6651;border-radius:.5em;box-shadow:1px 1px .5em #000 inset}:not(pre)>code[class*=language-]{padding:.15em .2em .05em;border-radius:.3em;border:.13em solid #7a6651;box-shadow:1px 1px .3em -.1em #000 inset;white-space:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#997f66}.token.punctuation{opacity:.7}.token.namespace{opacity:.7}.token.boolean,.token.constant,.token.number,.token.property,.token.symbol,.token.tag{color:#d1939e}.token.attr-name,.token.builtin,.token.char,.token.inserted,.token.selector,.token.string{color:#bce051}.language-css .token.string,.style .token.string,.token.entity,.token.operator,.token.url,.token.variable{color:#f4b73d}.token.atrule,.token.attr-value,.token.keyword{color:#d1939e}.token.important,.token.regex{color:#e90}.token.bold,.token.important{font-weight:700}.token.italic{font-style:italic}.token.entity{cursor:help}.token.deleted{color:red}`}</style>
   );
 
-const StylePreTag = styled.pre`
+const StylePreTag = styled.pre<WithThemeSchemeProp>`
   width: 100%;
   margin: 0 !important;
   padding: 0 !important;
 
   box-shadow: none !important;
   text-shadow: none !important;
+
+  ${({ themeScheme }) => css`
+    background-color: ${NamedColors.CARD[themeScheme]} !important;
+    border: 1px solid ${NamedColors.BORDER_DEFAULT[themeScheme]} !important;
+  `};
 `;
 
-export const StyledCodeTag = styled.code<WithThemeSchemeProp>`
+export const StyledCodeTag = styled.code`
   display: block;
 
   min-height: 20px;

...
@@ -73,9 +75,4 @@ export const StyledCodeTag = styled.code<WithThemeSchemeProp>`
 
   font-size: 16px;
   border-radius: 4px !important;
-
-  ${({ themeScheme }) => css`
-    background-color: ${NamedColors.CARD[themeScheme]} !important;
-    border: 1px solid ${NamedColors.BORDER_DEFAULT[themeScheme]} !important;
-  `};
 `;