-
Notifications
You must be signed in to change notification settings - Fork 842
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
[Emotion] Convert EuiFormLabel and EuiFormLegend #7967
Changes from 1 commit
2274458
001c59c
386fc74
322e041
080f831
9829dde
c65d56b
dc2ede9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
.euiFormLegend { | ||
@include euiFormLabel; | ||
|
||
&:not(.euiFormLegend-isHidden) { | ||
margin-bottom: $euiSizeS; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* 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 { euiFormLabel } from '../form_label/form_label.styles'; | ||
|
||
export const euiFormLegendStyles = (euiThemeContext: UseEuiTheme) => { | ||
return { | ||
euiFormLegend: css` | ||
${euiFormLabel(euiThemeContext)} | ||
`, | ||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
* 2. Disabled state overrides pointer. | ||
*/ | ||
.euiFormLabel { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When we remove this from our sass files ... is it still available globally for use like this? Or will that cause an issue: https://github.com/elastic/kibana/blob/main/x-pack/plugins/cases/public/components/configure_cases/field_mapping.tsx#L35 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, it will cause an issue! I'll change their usage to the |
||
@include euiFormLabel; | ||
display: inline-block; | ||
transition: all $euiAnimSpeedFast $euiAnimSlightResistance; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* 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 { serializeStyles, type CSSObject } from '@emotion/serialize'; | ||
|
||
import { UseEuiTheme } from '../../../services'; | ||
import { euiTextBreakWord } from '../../../global_styling'; | ||
import { euiTitle } from '../../title/title.styles'; | ||
|
||
export const euiFormLabel = (euiThemeContext: UseEuiTheme) => { | ||
const { euiTheme } = euiThemeContext; | ||
// Exclude the fontWeight from the title, since we're setting our own later | ||
const { fontWeight: _, ..._titleStyles } = euiTitle(euiThemeContext, 'xxxs'); | ||
// Since we're not returning a css`` string (to avoid generating an extra Emotion | ||
// className), we need to manually serialize the style object into a string | ||
const titleStyles = serializeStyles([_titleStyles as CSSObject]).styles; | ||
|
||
return ` | ||
${titleStyles} | ||
font-weight: ${euiTheme.font.weight.semiBold}; | ||
${euiTextBreakWord()} | ||
`; | ||
}; | ||
|
||
export const euiFormLabelStyles = (euiThemeContext: UseEuiTheme) => { | ||
return { | ||
euiFormLabel: css` | ||
${euiFormLabel(euiThemeContext)} | ||
`, | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only see this being used once in Kibana, so shouldn't be a big change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for looking into it! I'll likely change their usage to the
<EuiFormLabel />
component directly.