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

[EuiSuperDatePicker] Convert date popover styles to Emotion #7908

Merged
merged 9 commits into from
Jul 25, 2024
3 changes: 3 additions & 0 deletions packages/eui/changelogs/upcoming/7908.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**CSS-in-JS conversions**

- Converted `EuiSuperDatePicker`'s date popover content to Emotion
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import 'date_popover/index';
@import 'quick_select_popover/index';

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { css } from '@emotion/react';

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

export const euiAbsoluteTabDateFormStyles = (euiThemeContext: UseEuiTheme) => {
const { euiTheme } = euiThemeContext;

return {
euiAbsoluteTabDateForm: css`
${logicalCSS('padding-horizontal', euiTheme.size.s)}
${logicalCSS('padding-bottom', euiTheme.size.s)}
`,
euiAbsoluteTabDateForm__submit: css`
flex-shrink: 0;
`,
euiAbsoluteTabDateForm__row: css`
flex-grow: 1;

/* CSS hack to make the help/error text extend to the submit button.
* We can't actually put the submit button within an EuiFormRow due to
* cloneElement limitations (https://github.com/elastic/eui/issues/2493#issuecomment-561278494)
* TODO: Remove this and clean up DOM rendering once we can
*/
.euiFormRow__text {
${logicalCSS(
'margin-right',
mathWithUnits(
[euiTheme.size.xl, euiTheme.size.s],
(submitButtonSize, gapSize) => -1 * (submitButtonSize + gapSize)
)
)}
}
`,
};
};
Loading
Loading