Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
a4e49e4a
Unverified
Commit
a4e49e4a
authored
Jan 11, 2021
by
Jack Westbrook
Committed by
GitHub
Jan 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs(badge): migrate story to use controls (#30180)
parent
9e4b055b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
23 deletions
+18
-23
packages/grafana-ui/src/components/Badge/Badge.story.tsx
+18
-23
No files found.
packages/grafana-ui/src/components/Badge/Badge.story.tsx
View file @
a4e49e4a
import
React
from
'react'
;
import
{
boolean
,
text
,
select
}
from
'@storybook/addon-knobs'
;
import
{
Badge
,
BadgeColor
}
from
'@grafana/ui'
;
import
{
Story
}
from
'@storybook/react'
;
import
{
Badge
,
BadgeProps
}
from
'@grafana/ui'
;
import
{
iconOptions
}
from
'../../utils/storybook/knobs'
;
export
default
{
title
:
'Data Display/Badge'
,
...
...
@@ -8,28 +9,22 @@ export default {
decorators
:
[],
parameters
:
{
docs
:
{},
knobs
:
{
disabled
:
true
,
},
},
argTypes
:
{
icon
:
{
control
:
{
type
:
'select'
,
options
:
iconOptions
}
},
color
:
{
control
:
'select'
},
},
};
export
const
basic
=
()
=>
{
const
badgeColor
=
select
<
BadgeColor
>
(
'Badge color'
,
{
Red
:
'red'
,
Green
:
'green'
,
Blue
:
'blue'
,
Orange
:
'orange'
,
},
'blue'
);
const
withIcon
=
boolean
(
'With icon'
,
true
);
const
tooltipText
=
text
(
'Tooltip text'
,
''
);
return
(
<
Badge
text=
{
'Badge label'
}
color=
{
badgeColor
}
icon=
{
withIcon
?
'rocket'
:
undefined
}
tooltip=
{
tooltipText
.
trim
()
===
''
?
undefined
:
tooltipText
}
/>
);
const
Template
:
Story
<
BadgeProps
>
=
args
=>
<
Badge
{
...
args
}
/>;
export
const
Basic
=
Template
.
bind
({});
Basic
.
args
=
{
text
:
'Badge label'
,
color
:
'blue'
,
icon
:
'rocket'
,
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment