-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Migrate influencers list from SCSS to Emotion (#200019)
## Summary Part of: [#140695](#140695) Migrates SCSS to emotion for Influencers list. | Before | After | | ------------- | ------------- | | ![image](https://github.com/user-attachments/assets/1f85b2d1-5526-49b2-819d-525989b9c48d) | ![image](https://github.com/user-attachments/assets/e1e5745e-d00a-4a51-ab93-b29ff71d8aef) | | ![image](https://github.com/user-attachments/assets/f1e8d594-8a9d-4f08-98bb-156e21abd1c6) | ![image](https://github.com/user-attachments/assets/d55a2848-2c28-4b4b-88b2-ed1b98b16430) |
- Loading branch information
Showing
5 changed files
with
103 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
x-pack/plugins/ml/public/application/components/influencers_list/_index.scss
This file was deleted.
Oops, something went wrong.
109 changes: 0 additions & 109 deletions
109
x-pack/plugins/ml/public/application/components/influencers_list/_influencers_list.scss
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
x-pack/plugins/ml/public/application/components/influencers_list/influencers_list_styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { css } from '@emotion/react'; | ||
import { useCurrentEuiThemeVars } from '@kbn/ml-kibana-theme'; | ||
import { mlColors } from '../../styles'; | ||
import { useMlKibana } from '../../contexts/kibana'; | ||
|
||
export const useInfluencersListStyles = () => { | ||
const { | ||
services: { theme }, | ||
} = useMlKibana(); | ||
const { euiTheme } = useCurrentEuiThemeVars(theme); | ||
|
||
return { | ||
influencersList: css({ | ||
lineHeight: 1.45, | ||
}), | ||
fieldLabel: css({ | ||
fontSize: euiTheme.euiFontSizeXS, | ||
textAlign: 'left', | ||
maxHeight: euiTheme.euiFontSizeS, | ||
maxWidth: 'calc(100% - 102px)', | ||
}), | ||
progress: css({ | ||
display: 'inline-block', | ||
width: 'calc(100% - 34px)', | ||
height: '22px', | ||
minWidth: '70px', | ||
marginBottom: 0, | ||
color: euiTheme.euiColorDarkShade, | ||
backgroundColor: 'transparent', | ||
}), | ||
progressBarHolder: css({ | ||
width: `calc(100% - 28px)`, | ||
}), | ||
progressBar: (severity: string, barScore: number) => | ||
css({ | ||
height: `calc(${euiTheme.euiSizeXS} / 2)`, | ||
float: 'left', | ||
marginTop: euiTheme.euiSizeM, | ||
textAlign: 'right', | ||
lineHeight: '18px', | ||
display: 'inline-block', | ||
transition: 'none', | ||
width: `${barScore}%`, | ||
backgroundColor: | ||
severity === 'critical' | ||
? mlColors.critical | ||
: severity === 'major' | ||
? mlColors.major | ||
: severity === 'minor' | ||
? mlColors.minor | ||
: mlColors.warning, | ||
}), | ||
scoreLabel: (severity: string) => | ||
css({ | ||
textAlign: 'center', | ||
lineHeight: '14px', | ||
whiteSpace: 'nowrap', | ||
fontSize: euiTheme.euiFontSizeXS, | ||
marginLeft: euiTheme.euiSizeXS, | ||
display: 'inline', | ||
borderColor: | ||
severity === 'critical' | ||
? mlColors.critical | ||
: severity === 'major' | ||
? mlColors.major | ||
: severity === 'minor' | ||
? mlColors.minor | ||
: mlColors.warning, | ||
}), | ||
totalScoreLabel: css({ | ||
width: euiTheme.euiSizeXL, | ||
verticalAlign: 'top', | ||
textAlign: 'center', | ||
color: euiTheme.euiColorDarkShade, | ||
fontSize: '11px', | ||
lineHeight: '14px', | ||
borderRadius: euiTheme.euiBorderRadius, | ||
padding: `calc(${euiTheme.euiSizeXS} / 2)`, | ||
display: 'inline-block', | ||
border: euiTheme.euiBorderThin, | ||
}), | ||
}; | ||
}; |