-
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
Changes from 5 commits
441dec2
9c99675
0aa36ae
6ac237d
3175424
feb1bb6
e3ddcd0
9f81e53
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,11 +1,12 @@ | ||
import React from 'react'; | ||
import { css } from '@emotion/react'; | ||
|
||
import { EuiBetaBadge, EuiSpacer, EuiTitle } from '../../../../src/components'; | ||
|
||
const colors = ['hollow', 'accent', 'subdued']; | ||
const colors = ['hollow', 'accent', 'subdued'] as const; | ||
|
||
export default () => ( | ||
<div> | ||
<> | ||
{colors.map((item, index) => ( | ||
<div key={index}> | ||
<EuiBetaBadge | ||
|
@@ -41,20 +42,28 @@ export default () => ( | |
/> | ||
</h3> | ||
</EuiTitle> | ||
<EuiTitle size="xxs"> | ||
<h4>Clickable beta badges</h4> | ||
<EuiSpacer /> | ||
<EuiTitle size="xs"> | ||
<h3>Clickable beta badges</h3> | ||
</EuiTitle> | ||
<EuiSpacer size="s" /> | ||
<EuiBetaBadge | ||
label="Lens" | ||
iconType="lensApp" | ||
onClick={() => alert('Goes to Lens')} | ||
/> | ||
  | ||
<EuiBetaBadge | ||
label="Basic" | ||
href="http://www.elastic.co/subscriptions" | ||
target="_blank" | ||
/> | ||
</div> | ||
<div | ||
css={css` | ||
display: flex; | ||
align-items: center; | ||
gap: 0.5rem; | ||
`} | ||
> | ||
<EuiBetaBadge | ||
label="Lens" | ||
iconType="lensApp" | ||
onClick={() => alert('Goes to Lens')} | ||
/> | ||
Comment on lines
+60
to
+64
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. 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. 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 commentThe 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 commentThe 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! |
||
<EuiBetaBadge | ||
label="Basic" | ||
href="http://www.elastic.co/subscriptions" | ||
target="_blank" | ||
/> | ||
</div> | ||
</> | ||
); |
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,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}; | ||
`, | ||
}; | ||
}; |
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.
Instead of having the horizontal spaces between each EuiBetaBadge with a
 
what do you think of wrapping thecolors.map()
with a div with agap: 0.5rem;
?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 don't think this will work quite the way you expect because the
gap
will only apply to the immediate childdiv
s and not to the grandchild EuiBetaBadges (meaning there will no longer be a slight horizontal gap).To get this working with
gap
and without the 
s I think we should use a grid (which I'm happy to play around with!)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.
9f81e53