@@ -17,26 +17,79 @@ import {
1717import Badge from './badge' ;
1818const badgeSource = require ( '!!raw-loader!./badge' ) ;
1919const badgeHtml = renderToHtml ( Badge ) ;
20+ const badgeSnippet = [
21+ `<EuiBadge>Default</EuiBadge>
22+ ` ,
23+ `<EuiBadge color="hollow">Hollow</EuiBadge>
24+ ` ,
25+ `<EuiBadge color="primary">Primary</EuiBadge>
26+ ` ,
27+ `<EuiBadge color="#BADA55">Custom</EuiBadge>
28+ ` ,
29+ `<EuiBadge color="secondary" isDisabled>Disabled</EuiBadge>
30+ ` ,
31+ ] ;
2032
2133import BadgeWithIcon from './badge_with_icon' ;
2234const badgeWithIconSource = require ( '!!raw-loader!./badge_with_icon' ) ;
2335const badgeWithIconHtml = renderToHtml ( BadgeWithIcon ) ;
36+ const badgeWithIconSnippet = `<EuiBadge color="hollow" iconType="cross" iconSide="right">Label</EuiBadge>
37+ ` ;
2438
2539import BadgeButton from './badge_button' ;
2640const badgeButtonSource = require ( '!!raw-loader!./badge_button' ) ;
2741const badgeButtonHtml = renderToHtml ( BadgeButton ) ;
42+ const badgeButtonSnippet = [
43+ `<EuiBadge
44+ color="primary"
45+ onClick={this.onBadgeClick}
46+ onClickAriaLabel="Aria label applied to text button"
47+ />
48+ Clickable text
49+ </EuiBadge>` ,
50+ `<EuiBadge
51+ iconType="cross"
52+ iconSide="right"
53+ color="hollow"
54+ iconOnClick={this.onBadgeIconClick}
55+ iconOnClickAriaLabel="Aria label applied to icon button"
56+ />
57+ Text with clickable icon
58+ </EuiBadge>` ,
59+ `<EuiBadge
60+ iconType="cross"
61+ iconSide="right"
62+ color="secondary"
63+ onClick={this.onBadgeClick}
64+ onClickAriaLabel="Aria label applied to text button"
65+ iconOnClick={this.onBadgeIconClick}
66+ iconOnClickAriaLabel="Aria label applied to icon button"
67+ />
68+ Clickable text with clickable icon
69+ </EuiBadge>` ,
70+ ] ;
71+
72+ import BadgeTruncate from './badge_truncate' ;
73+ const badgeTruncateSource = require ( '!!raw-loader!./badge_truncate' ) ;
74+ const badgeTruncateHtml = renderToHtml ( BadgeTruncate ) ;
2875
2976import BetaBadge from './beta_badge' ;
3077const betaBadgeSource = require ( '!!raw-loader!./beta_badge' ) ;
3178const betaBadgeHtml = renderToHtml ( BetaBadge ) ;
79+ const betaBadgeSnippet = [
80+ `<EuiBetaBadge label="Beta" />
81+ ` ,
82+ `<EuiBetaBadge label="Lab" tooltipContent="Describe why this is considered beta." />
83+ ` ,
84+ `<EuiBetaBadge label="Lab" iconType="beaker" />
85+ ` ,
86+ ] ;
3287
3388import NotificationBadge from './notification_badge' ;
3489const notificationBadgeSource = require ( '!!raw-loader!./notification_badge' ) ;
3590const notificationBadgeHtml = renderToHtml ( NotificationBadge ) ;
36-
37- import BadgeTruncate from './badge_truncate' ;
38- const badgeTruncateSource = require ( '!!raw-loader!./badge_truncate' ) ;
39- const badgeTruncateHtml = renderToHtml ( BadgeTruncate ) ;
91+ const notificationBadgeSnippet = `<EuiNotificationBadge>3</EuiNotificationBadge>
92+ ` ;
4093
4194export const BadgeExample = {
4295 title : 'Badge' ,
@@ -58,10 +111,11 @@ export const BadgeExample = {
58111 they will automatically space themselves if you use them in a
59112 repetitive fashion it is good form to wrap them using a{ ' ' }
60113 < EuiCode > FlexGroup</ EuiCode > so that they will wrap when width is
61- constrained (as is done artificially in the example below).
114+ constrained (as seen in the custom color example below).
62115 </ p >
63116 ) ,
64117 props : { EuiBadge } ,
118+ snippet : badgeSnippet ,
65119 demo : < Badge /> ,
66120 } ,
67121 {
@@ -77,6 +131,7 @@ export const BadgeExample = {
77131 } ,
78132 ] ,
79133 text : < p > Badges can use icons on the left and right (default) sides.</ p > ,
134+ snippet : badgeWithIconSnippet ,
80135 demo : < BadgeWithIcon /> ,
81136 } ,
82137 {
@@ -111,6 +166,7 @@ export const BadgeExample = {
111166 </ EuiCallOut >
112167 </ div >
113168 ) ,
169+ snippet : badgeButtonSnippet ,
114170 demo : < BadgeButton /> ,
115171 } ,
116172 {
@@ -178,6 +234,7 @@ export const BadgeExample = {
178234 </ div >
179235 ) ,
180236 props : { EuiBetaBadge } ,
237+ snippet : betaBadgeSnippet ,
181238 demo : < BetaBadge /> ,
182239 } ,
183240 {
@@ -194,13 +251,14 @@ export const BadgeExample = {
194251 ] ,
195252 text : (
196253 < p >
197- Used to showcase the number of notifications, alerts or hidden
198- selections. Typically used in{ ' ' }
199- < Link to = "/layout/header" > EuiHeader</ Link > or (eventually) { ' ' }
200- < Link to = "/forms/filter-group" > EuiFilterButtons </ Link > .
254+ Used to showcase the number of notifications, alerts, or hidden
255+ selections. This badge type is commonly used in the { ' ' }
256+ < Link to = "/layout/header" > EuiHeader</ Link > and { ' ' }
257+ < Link to = "/forms/filter-group" > EuiFilterButton </ Link > components .
201258 </ p >
202259 ) ,
203260 props : { EuiNotificationBadge } ,
261+ snippet : notificationBadgeSnippet ,
204262 demo : < NotificationBadge /> ,
205263 } ,
206264 ] ,
0 commit comments