Skip to content

Commit

Permalink
[EuiCodeBlock] Fix border/margin interaction with EuiText
Browse files Browse the repository at this point in the history
border was including the margin-bottom on `pre` tags in text, which we don't want

reran VRT, no regressions
  • Loading branch information
cee-chen committed Dec 12, 2024
1 parent ae36491 commit e75d2fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/eui/src/components/code/code_block.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ export const euiCodeBlockStyles = (euiThemeContext: UseEuiTheme) => {
display: block;
position: relative;
background: ${codeSyntaxVariables.backgroundColor};
${highContrastModeStyles(euiThemeContext, {
preferred: `border: ${euiTheme.border.thin};`,
})}
${codeSyntaxVariables.tokensCss}
`,
// Font size
Expand Down Expand Up @@ -84,6 +80,10 @@ export const euiCodeBlockPreStyles = (euiThemeContext: UseEuiTheme) => {
overflow: auto;
display: block;
${euiScrollBarStyles(euiThemeContext)}
${highContrastModeStyles(euiThemeContext, {
// High contrast border must be on the <pre> element to play nicely with EuiText margins
preferred: `border: ${euiTheme.border.thin};`,
})}
`,
padding: {
...generatePaddingCss(euiThemeContext, (paddingSize: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ const euiScaleMarkdownFormatText = (
return `
.euiMarkdownFormat__codeblockWrapper {
${logicalCSS('margin-bottom', fontSize)}
.euiCodeBlock__pre {
${logicalCSS('margin-bottom', 0)}
}
}
.euiMarkdownFormat__table {
Expand Down

0 comments on commit e75d2fa

Please sign in to comment.