Skip to content

Commit

Permalink
WHY IS COMPRESSED DOING NOTHING
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Aug 15, 2024
1 parent 960d141 commit 19cf97a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
12 changes: 0 additions & 12 deletions packages/eui/src/components/form/form_row/_form_row.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
/**
* 2. For inline forms, we need to add margin if the label doesn't exist.
*/
.euiFormRow--hasEmptyLabelSpace {
margin-top: $euiSize + $euiSizeXS; /* 2 */
// the following ensure that contents that aren't inherently the same height
// as inputs will align to the vertical center
min-height: $euiFormControlHeight;
padding-bottom: 0;
justify-content: center;
}

.euiFormRow__labelWrapper {
display: flex;
flex-wrap: wrap;
Expand Down
25 changes: 21 additions & 4 deletions packages/eui/src/components/form/form_row/form_row.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
import { css } from '@emotion/react';

import { UseEuiTheme } from '../../../services';
import { logicalCSS } from '../../../global_styling';
import { euiFormMaxWidth } from '../form.styles';
import { logicalCSS, mathWithUnits } from '../../../global_styling';
import { euiFormVariables } from '../form.styles';

export const euiFormRowStyles = (euiThemeContext: UseEuiTheme) => {
const { euiTheme } = euiThemeContext;
const maxWidth = euiFormMaxWidth(euiThemeContext);
const { maxWidth, controlHeight, controlCompressedHeight } =
euiFormVariables(euiThemeContext);

return {
euiFormRow: css`
/* Coerce inline form elements to behave as block-level elements */
display: flex;
+ .euiFormRow,
+ .euiButton {
${logicalCSS('margin-top', euiTheme.size.base)}
}
Expand All @@ -38,14 +38,31 @@ export const euiFormRowStyles = (euiThemeContext: UseEuiTheme) => {
// Skip css`` to avoid generating an Emotion className
row: `
flex-direction: column;
&:has(+ .euiFormRow) {
${logicalCSS('margin-bottom', euiTheme.size.base)}
}
`,
},

column: {
column: css`
flex-direction: row;
align-items: stretch;
&:has(+ .euiFormRow) {
${logicalCSS('margin-bottom', euiTheme.size.s)}
}
`,
},

hasEmptyLabelSpace: css`
${logicalCSS(
// For inline forms, we need to add margin if the label doesn't exist.
'margin-top',
mathWithUnits([euiTheme.size.base, euiTheme.size.xs], (x, y) => x + y)
)}
justify-content: center;
`,
};
};

0 comments on commit 19cf97a

Please sign in to comment.