forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI Framework][K7]: Badge component (elastic#13520)
Adds badge component to K7 UI.
- Loading branch information
Showing
13 changed files
with
392 additions
and
0 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
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,44 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
KuiBadge, | ||
} from '../../../../components'; | ||
|
||
export default () => ( | ||
<div> | ||
<KuiBadge type="default"> | ||
Default | ||
</KuiBadge> | ||
|
||
| ||
|
||
<KuiBadge type="primary"> | ||
Primary | ||
</KuiBadge> | ||
|
||
| ||
|
||
<KuiBadge type="secondary"> | ||
Secondary | ||
</KuiBadge> | ||
|
||
| ||
|
||
<KuiBadge type="accent"> | ||
Accent | ||
</KuiBadge> | ||
|
||
| ||
|
||
<KuiBadge type="warning"> | ||
Warning | ||
</KuiBadge> | ||
|
||
| ||
|
||
<KuiBadge type="danger"> | ||
Danger | ||
</KuiBadge> | ||
</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,61 @@ | ||
import React from 'react'; | ||
|
||
import { renderToHtml } from '../../services'; | ||
|
||
import { | ||
GuideDemo, | ||
GuidePage, | ||
GuideSection, | ||
GuideSectionTypes, | ||
GuideText, | ||
} from '../../components'; | ||
|
||
import Badge from './badge'; | ||
const badgeSource = require('!!raw!./badge'); | ||
const badgeHtml = renderToHtml(Badge); | ||
|
||
import BadgeWithIcon from './badge_with_icon'; | ||
const badgeWithIconSource = require('!!raw!./badge_with_icon'); | ||
const badgeWithIconHtml = renderToHtml(BadgeWithIcon); | ||
|
||
export default props => ( | ||
<GuidePage title={props.route.name}> | ||
<GuideSection | ||
title="Badge" | ||
source={[{ | ||
type: GuideSectionTypes.JS, | ||
code: badgeSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: badgeHtml, | ||
}]} | ||
> | ||
<GuideText> | ||
Badges are used to focus on important bits of information. | ||
</GuideText> | ||
|
||
<GuideDemo> | ||
<Badge /> | ||
</GuideDemo> | ||
</GuideSection> | ||
|
||
<GuideSection | ||
title="Badge with Icon" | ||
source={[{ | ||
type: GuideSectionTypes.JS, | ||
code: badgeWithIconSource, | ||
}, { | ||
type: GuideSectionTypes.HTML, | ||
code: badgeWithIconHtml, | ||
}]} | ||
> | ||
<GuideText> | ||
Badges can use icons on the left and right (default) sides. | ||
</GuideText> | ||
|
||
<GuideDemo> | ||
<BadgeWithIcon /> | ||
</GuideDemo> | ||
</GuideSection> | ||
</GuidePage> | ||
); |
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 { | ||
KuiBadge, | ||
} from '../../../../components'; | ||
|
||
export default () => ( | ||
<div> | ||
|
||
<KuiBadge iconType="help"> | ||
Primary | ||
</KuiBadge> | ||
|
||
| ||
|
||
<KuiBadge type="primary" iconType="user" iconSide="left"> | ||
Secondary | ||
</KuiBadge> | ||
|
||
</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,49 @@ | ||
.kuiBadge { | ||
font-size: $kuiSizeM; | ||
line-height: $kuiSizeL; | ||
display: inline-block; | ||
text-decoration: none; | ||
border: solid 1px transparent; | ||
border-radius: $kuiSizeL; | ||
padding: 0 $kuiSizeS; | ||
background-color: transparent; | ||
white-space: nowrap; | ||
vertical-align: middle; | ||
|
||
.kuiBadge__content { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
.kuiBadge__icon { | ||
margin-left: $kuiSizeXS; | ||
} | ||
|
||
&.kuiBadge--iconLeft .kuiBadge__content { | ||
flex-direction: row-reverse; | ||
|
||
.kuiBadge__icon { | ||
margin-right: $kuiSizeXS; | ||
margin-left: 0; | ||
} | ||
} | ||
} | ||
|
||
|
||
// Modifier naming and colors. | ||
$badgeTypes: ( | ||
default: $kuiColorLightShade, | ||
primary: $kuiColorPrimary, | ||
secondary: $kuiColorSecondary, | ||
warning: $kuiColorWarning, | ||
danger: $kuiColorDanger, | ||
accent: $kuiColorAccent | ||
); | ||
|
||
@each $name, $color in $badgeTypes { | ||
.kuiBadge--#{$name} { | ||
border-color: $color; | ||
background-color: transparentize($color, .9); | ||
} | ||
} |
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 'badge'; |
Oops, something went wrong.