-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
485 additions
and
14 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiBetaBadge, | ||
EuiSpacer, | ||
EuiTitle, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<div> | ||
<EuiBetaBadge label="Beta" tooltipContent="This module is not GA. Please help us by reporting any bugs." /> | ||
  | ||
<EuiBetaBadge label="Lab" title="Laboratory" tooltipContent="This module is not GA. Please help us by reporting any bugs." /> | ||
  | ||
<EuiBetaBadge label="Lightening" iconType="bolt" /> | ||
|
||
<EuiSpacer /> | ||
<EuiTitle> | ||
<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> | ||
</div> | ||
); |
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,32 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiCard, | ||
EuiIcon, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '../../../../src/components'; | ||
|
||
const icons = ['dashboard', 'monitoring', 'watches']; | ||
const badges = [null, 'Beta', 'Lab']; | ||
|
||
const cardNodes = icons.map(function (item, index) { | ||
return ( | ||
<EuiFlexItem key={index}> | ||
<EuiCard | ||
icon={<EuiIcon size="xxl" type={`${item}App`} />} | ||
title={`Kibana ${item}`} | ||
description="Example of a card's description. Stick to one or two sentences." | ||
betaBadgeLabel={badges[index]} | ||
betaBadgeTooltipContent={badges[index] ? "This module is not GA. Please help us by reporting any bugs." : undefined} | ||
onClick={() => window.alert('Card clicked')} | ||
/> | ||
</EuiFlexItem> | ||
); | ||
}); | ||
|
||
export default () => ( | ||
<EuiFlexGroup gutterSize="l"> | ||
{cardNodes} | ||
</EuiFlexGroup> | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
EuiIcon, | ||
EuiKeyPadMenu, | ||
EuiKeyPadMenuItem, | ||
} from '../../../../src/components'; | ||
|
||
export default () => ( | ||
<EuiKeyPadMenu> | ||
<EuiKeyPadMenuItem | ||
label="Dashboard" | ||
href="#" | ||
> | ||
<EuiIcon type="dashboardApp" size="l" /> | ||
</EuiKeyPadMenuItem> | ||
|
||
<EuiKeyPadMenuItem | ||
label="Dashboard" | ||
href="#" | ||
betaBadgeLabel="Beta" | ||
betaBadgeTooltipContent="This module is not GA. Please help us by reporting any bugs." | ||
> | ||
<EuiIcon type="dashboardApp" size="l" /> | ||
</EuiKeyPadMenuItem> | ||
|
||
<EuiKeyPadMenuItem | ||
label="Dashboard" | ||
href="#" | ||
betaBadgeLabel="Lab" | ||
betaBadgeTooltipContent="This module is not GA. Please help us by reporting any bugs." | ||
betaBadgeIconType="bolt" | ||
> | ||
<EuiIcon type="dashboardApp" size="l" /> | ||
</EuiKeyPadMenuItem> | ||
</EuiKeyPadMenu> | ||
); |
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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
@import 'badge'; | ||
@import 'beta_badge/index'; |
12 changes: 12 additions & 0 deletions
12
src/components/badge/beta_badge/__snapshots__/beta_badge.test.js.snap
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,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`EuiBetaBadge is rendered 1`] = ` | ||
<span | ||
aria-label="aria-label" | ||
class="euiBetaBadge testClass1 testClass2" | ||
data-test-subj="test subject string" | ||
title="Beta" | ||
> | ||
Beta | ||
</span> | ||
`; |
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,30 @@ | ||
.euiBetaBadge { | ||
display: inline-block; | ||
padding: 0 $euiSizeL; | ||
border-radius: $euiSizeL; | ||
background-color: $euiColorAccent; | ||
vertical-align: super; // if displayed inline with text | ||
@include euiSlightShadowHover($euiColorAccent); | ||
|
||
font-size: $euiFontSizeXS; | ||
font-weight: $euiFontWeightBold; | ||
text-transform: uppercase; | ||
letter-spacing: .05em; | ||
color: chooseLightOrDarkText($euiColorAccent, $euiColorEmptyShade, $euiColorFullShade); | ||
line-height: $euiSizeL; | ||
text-align: center; | ||
white-space: nowrap; | ||
|
||
cursor: default; | ||
|
||
// When it's just an icon, make it a circle | ||
&.euiBetaBadge--iconOnly { | ||
padding: 0; | ||
width: $euiSizeL; | ||
|
||
.euiBetaBadge__icon { | ||
position: relative; | ||
margin-top: -1px; | ||
} | ||
} | ||
} |
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 @@ | ||
@import 'beta_badge'; |
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,101 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import classNames from 'classnames'; | ||
|
||
import { EuiToolTip } from '../../tool_tip'; | ||
|
||
import { | ||
ICON_TYPES, | ||
EuiIcon, | ||
} from '../../icon'; | ||
|
||
export const EuiBetaBadge = ({ | ||
className, | ||
label, | ||
tooltipContent, | ||
tooltipPosition, | ||
title, | ||
iconType, | ||
...rest, | ||
}) => { | ||
|
||
const classes = classNames( | ||
'euiBetaBadge', | ||
{ | ||
'euiBetaBadge--iconOnly': iconType, | ||
}, | ||
className | ||
); | ||
|
||
let icon; | ||
if (iconType) { | ||
icon = ( | ||
<EuiIcon | ||
className="euiBetaBadge__icon" | ||
type={iconType} | ||
size="m" | ||
aria-hidden="true" | ||
/> | ||
); | ||
} | ||
|
||
if (tooltipContent) { | ||
return ( | ||
<EuiToolTip | ||
position={tooltipPosition} | ||
content={tooltipContent} | ||
title={title || label} | ||
> | ||
<span | ||
className={classes} | ||
{...rest} | ||
> | ||
{icon || label} | ||
</span> | ||
</EuiToolTip> | ||
); | ||
} else { | ||
return ( | ||
<span | ||
className={classes} | ||
title={title || label} | ||
{...rest} | ||
> | ||
{icon || label} | ||
</span> | ||
) | ||
} | ||
} | ||
|
||
EuiBetaBadge.propTypes = { | ||
className: PropTypes.string, | ||
|
||
/** | ||
* One word label like "Beta" or "Lab" | ||
*/ | ||
label: PropTypes.node.isRequired, | ||
|
||
/** | ||
* Supply an icon type if the badge should just be an icon | ||
*/ | ||
iconType: PropTypes.oneOf(ICON_TYPES), | ||
|
||
/** | ||
* Content for the tooltip | ||
*/ | ||
tooltipContent: PropTypes.node, | ||
|
||
/** | ||
* Custom position of the tooltip | ||
*/ | ||
tooltipPosition: PropTypes.string, | ||
|
||
/** | ||
* Optional title will be supplied as tooltip title or title attribute otherwise the label will be used | ||
*/ | ||
title: PropTypes.string, | ||
} | ||
|
||
EuiBetaBadge.defaultProps = { | ||
tooltipPosition: 'top', | ||
}; |
Oops, something went wrong.