Skip to content

Commit

Permalink
refactor: updates border implementation on panels
Browse files Browse the repository at this point in the history
- prevents transparent borders showing on colored full-width content, e.g. for EuiSplitPanel

- keeps using borderBaseFloating token as it provides expected split between Amsterdam and Borealis
  • Loading branch information
mgadewoll committed Jan 13, 2025
1 parent b9c74a0 commit 2168cd7
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions packages/eui/src/components/panel/panel.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,30 @@

import { css } from '@emotion/react';
import { euiShadow } from '../../themes/amsterdam/global_styling/mixins';
import { UseEuiTheme } from '../../services';
import { COLOR_MODES_STANDARD, UseEuiTheme } from '../../services';
import {
euiCanAnimate,
logicalCSS,
logicalTextAlignCSS,
} from '../../global_styling';

export const euiPanelStyles = (euiThemeContext: UseEuiTheme) => {
const { euiTheme } = euiThemeContext;
const { euiTheme, colorMode } = euiThemeContext;
const isDark = colorMode === COLOR_MODES_STANDARD.dark;

const borderStyle = `
position: relative;
::before {
content: '';
position: absolute;
inset: 0;
border: ${euiTheme.border.width.thin} solid
${euiTheme.colors.borderBaseFloating};
border-radius: inherit;
pointer-events: none;
}
`;

return {
// Base
Expand All @@ -30,8 +45,11 @@ export const euiPanelStyles = (euiThemeContext: UseEuiTheme) => {

hasShadow: css`
${euiShadow(euiThemeContext, 'm')}
border: ${euiTheme.border.width.thin} solid ${euiTheme.colors
.borderBaseFloating};
/* Using a pseudo element for the border instead of floating border only
because the transparent border might otherwise be visible with arbitrary
full-width/height content in light mode. */
${isDark && borderStyle}
`,

hasBorder: css`
Expand Down

0 comments on commit 2168cd7

Please sign in to comment.