Skip to content

Commit b563ba4

Browse files
committed
Work with high contrasced and forced colors
1 parent 2704efd commit b563ba4

1 file changed

Lines changed: 37 additions & 22 deletions

File tree

packages/eui/src/components/basic_table/basic_table.styles.ts

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88

99
import { css, keyframes } from '@emotion/react';
1010

11-
import { logicalCSS, euiCantAnimate } from '../../global_styling';
11+
import {
12+
logicalCSS,
13+
euiCantAnimate,
14+
highContrastModeStyles,
15+
preventForcedColors,
16+
} from '../../global_styling';
1217
import { UseEuiTheme } from '../../services';
1318

1419
const tableLoadingLine = keyframes`
@@ -33,30 +38,40 @@ const tableLoadingLine = keyframes`
3338
}
3439
`;
3540

36-
export const euiBasicTableBodyLoading = ({ euiTheme }: UseEuiTheme) => css`
37-
position: relative;
38-
overflow: hidden;
41+
export const euiBasicTableBodyLoading = (euiThemeContext: UseEuiTheme) => {
42+
const { euiTheme } = euiThemeContext;
43+
44+
return css`
45+
position: relative;
46+
overflow: hidden;
47+
48+
&::before {
49+
position: absolute;
50+
content: '';
51+
${logicalCSS('width', '100%')}
52+
${logicalCSS('height', euiTheme.border.width.thick)}
53+
background-color: ${euiTheme.colors.primary};
54+
animation: ${tableLoadingLine} 1s linear infinite;
3955
40-
&::before {
41-
position: absolute;
42-
content: '';
43-
${logicalCSS('width', '100%')}
44-
${logicalCSS('height', euiTheme.border.width.thick)}
45-
background-color: ${euiTheme.colors.primary};
46-
animation: ${tableLoadingLine} 1s linear infinite;
56+
${euiCantAnimate} {
57+
animation: none;
58+
background: repeating-linear-gradient(
59+
-45deg,
60+
${euiTheme.colors.backgroundBasePlain},
61+
${euiTheme.colors.backgroundBasePlain} ${euiTheme.size.xs},
62+
${euiTheme.colors.primary} ${euiTheme.size.xs},
63+
${euiTheme.colors.primary} ${euiTheme.size.s}
64+
);
4765
48-
${euiCantAnimate} {
49-
animation: none;
50-
background: repeating-linear-gradient(
51-
-45deg,
52-
transparent,
53-
transparent ${euiTheme.size.xs},
54-
${euiTheme.colors.primary} ${euiTheme.size.xs},
55-
${euiTheme.colors.primary} ${euiTheme.size.s}
56-
);
66+
${highContrastModeStyles(euiThemeContext, {
67+
forced: `
68+
${preventForcedColors(euiThemeContext)}
69+
`,
70+
})}
71+
}
5772
}
58-
}
59-
`;
73+
`;
74+
};
6075

6176
// Fix to make the loading indicator position correctly in Safari
6277
// For whatever annoying reason, Safari doesn't respect `position: relative;`

0 commit comments

Comments
 (0)