-
Notifications
You must be signed in to change notification settings - Fork 844
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 EuiBadgeGroup, EuiBetaBadge, and EuiNotificationBadge #6258
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
441dec2
Convert EuiBadgeGroup to Emotion
cee-chen 9c99675
Convert EuiBetaBadge to Emotion
cee-chen 0aa36ae
[docs] beta badge docs improvement
cee-chen 6ac237d
Convert EuiNotificationBadge to Emotion
cee-chen 3175424
changelog
cee-chen feb1bb6
[PR feedback] euiTextTruncate
cee-chen e3ddcd0
[PR feedback] Create internal color util for badge colors
cee-chen 9f81e53
[PR feedback] Remove ` `s from beta badge docs
cee-chen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import React from 'react'; | ||
import { css } from '@emotion/react'; | ||
|
||
import { EuiBetaBadge, EuiSpacer, EuiTitle } from '../../../../src/components'; | ||
|
||
const colors = ['hollow', 'accent', 'subdued'] as const; | ||
|
||
export default () => ( | ||
<> | ||
<div | ||
css={css` | ||
display: grid; | ||
align-items: flex-start; | ||
grid: repeat(3, max-content) / repeat(6, max-content); | ||
gap: 0.75rem; | ||
`} | ||
> | ||
{colors.map((item) => ( | ||
<> | ||
<EuiBetaBadge | ||
label="Beta" | ||
color={item} | ||
tooltipContent="This module is not GA. Please help us by reporting any bugs." | ||
/> | ||
<EuiBetaBadge | ||
label="Beta" | ||
color={item} | ||
size="s" | ||
tooltipContent="This module is not GA. Please help us by reporting any bugs." | ||
/> | ||
<EuiBetaBadge label="Beta" color={item} iconType="beta" /> | ||
<EuiBetaBadge size="s" label="Beta" color={item} iconType="beta" /> | ||
<EuiBetaBadge label="Lab" color={item} iconType="beaker" /> | ||
<EuiBetaBadge label="Lab" size="s" color={item} iconType="beaker" /> | ||
</> | ||
))} | ||
</div> | ||
<EuiSpacer size="s" /> | ||
<EuiTitle size="s"> | ||
<h3> | ||
Beta badges will also line up nicely with titles | ||
<EuiBetaBadge | ||
label="Lab" | ||
tooltipContent="This module is not GA. Please help us by reporting any bugs." | ||
/> | ||
</h3> | ||
</EuiTitle> | ||
<EuiSpacer /> | ||
<EuiTitle size="xs"> | ||
<h3>Clickable beta badges</h3> | ||
</EuiTitle> | ||
<EuiSpacer size="s" /> | ||
<div | ||
css={css` | ||
display: flex; | ||
align-items: center; | ||
gap: 0.75rem; | ||
`} | ||
> | ||
<EuiBetaBadge | ||
label="Lens" | ||
iconType="lensApp" | ||
onClick={() => alert('Goes to Lens')} | ||
/> | ||
<EuiBetaBadge | ||
label="Basic" | ||
href="http://www.elastic.co/subscriptions" | ||
target="_blank" | ||
/> | ||
</div> | ||
</> | ||
); |
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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 { logicalCSS } from '../../../global_styling'; | ||
import { UseEuiTheme } from '../../../services'; | ||
|
||
export const euiBadgeGroupStyles = ({ euiTheme }: UseEuiTheme) => { | ||
return { | ||
euiBadgeGroup: css` | ||
display: inline-flex; | ||
flex-wrap: wrap; | ||
${logicalCSS('max-width', '100%')} | ||
|
||
// Override the .euiBadge + .euiBadge CSS in badge.styles.ts | ||
.euiBadge { | ||
${logicalCSS('margin-left', 0)} | ||
} | ||
`, | ||
// Gutter sizes | ||
none: css``, | ||
s: css` | ||
gap: ${euiTheme.size.s}; | ||
`, | ||
xs: css` | ||
gap: ${euiTheme.size.xs}; | ||
`, | ||
}; | ||
}; |
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 noticed in CodeSandbox that still has the
.scss
this example doesn't get a circular EuiBetaBadge:If I copy the new styles and add them in Chrome developer tool the beta badge doesn't get circular. So not sure if this issue keeps persisting with the new styles.
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.
CodeSandbox doesn't update until our releases, so I can't say for sure. If the staging/local example works, I think this should work.
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.
If you look at the current version (https://elastic.github.io/eui/#/display/badge#beta-badge-type) it works in staging/local but it looks different in CodeSandbox. The beta badge with the lens icon doesn't get circular.
So I'm not sure this problem will persist. But we can take a look after this PR is merged and there's a new release.
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.
let's wait until the release, it's a little too hard for me to debug right now with the different styles. If it persists after release I think I may have a solution however!