Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert cell styles to Emotion (row cells, header/footer cells, & cell checkboxes) #7631

Merged
merged 15 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/components/table/_responsive.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@

@include euiBreakpoint('xs', 's') {
.euiTable.euiTable--responsive {
.euiTableRowCell__mobileHeader {
// Always truncate
@include euiTextTruncate;
@include fontSize($euiFontSize * .6875);

color: $euiColorDarkShade;
padding: $euiSizeS;
padding-bottom: 0;
margin-bottom: -$euiSizeS; // pull up cell content closer
min-height: $euiSizeL; // aligns contents of cells if header doesn't exist

// Remove min-height of cell header if it's the only cell
.euiTableRowCell:only-child & {
min-height: 0;
}
}

.euiTableRowCellCheckbox {
border: none;
}
Expand Down
22 changes: 21 additions & 1 deletion src/components/table/table_row_cell.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { css } from '@emotion/react';

import { UseEuiTheme } from '../../services';
import { euiFontSize, logicalCSS } from '../../global_styling';
import { euiFontSize, euiTextTruncate, logicalCSS } from '../../global_styling';

import { euiTableVariables } from './table.styles';

Expand Down Expand Up @@ -100,5 +100,25 @@ export const euiTableRowCellStyles = (euiThemeContext: UseEuiTheme) => {
}
`,
},

euiTableRowCell__mobileHeader: css`
/* Always truncate */
${euiTextTruncate()}
font-size: ${euiFontSize(euiThemeContext, 's', {
JasonStoltz marked this conversation as resolved.
Show resolved Hide resolved
customScale: 'xxs',
}).fontSize};

display: block;
color: ${euiTheme.colors.darkShade};
padding: ${euiTheme.size.s};
/* Pull up cell content closer */
padding-block-end: 0;
JasonStoltz marked this conversation as resolved.
Show resolved Hide resolved
margin-block-end: -${euiTheme.size.s};

/* Aligns contents of cells if header is empty */
.euiTableRowCell:not(:only-child) & {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I 👀 you refactoring two lines into 1.

${logicalCSS('min-height', euiTheme.size.l)}
}
`,
};
};
1 change: 1 addition & 0 deletions src/components/table/table_row_cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ export const EuiTableRowCell: FunctionComponent<Props> = ({
{/* Mobile-only header */}
{mobileOptions.header && (
<div
css={styles.euiTableRowCell__mobileHeader}
className={`euiTableRowCell__mobileHeader ${showForMobileClasses}`}
>
{mobileOptions.header}
Expand Down