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
055ca7bd
Unverified
Commit
055ca7bd
authored
Oct 21, 2019
by
Peter Holmberg
Committed by
GitHub
Oct 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix: Correct color on TagItems (#19933)
parent
09cf9711
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
7 deletions
+14
-7
packages/grafana-ui/src/components/TagsInput/TagItem.tsx
+14
-7
No files found.
packages/grafana-ui/src/components/TagsInput/TagItem.tsx
View file @
055ca7bd
import
React
,
{
FC
}
from
'react'
;
import
{
css
,
cx
}
from
'emotion'
;
import
{
getTagColorsFromName
}
from
'../../utils'
;
import
{
stylesFactory
}
from
'../../themes'
;
import
{
stylesFactory
,
useTheme
}
from
'../../themes'
;
import
{
GrafanaTheme
}
from
'../../types'
;
interface
Props
{
name
:
string
;
...
...
@@ -9,12 +10,13 @@ interface Props {
onRemove
:
(
tag
:
string
)
=>
void
;
}
export
const
TagItem
:
FC
<
Props
>
=
({
name
,
onRemove
})
=>
{
const
getStyles
=
stylesFactory
(({
theme
,
name
}:
{
theme
:
GrafanaTheme
;
name
:
string
})
=>
{
const
{
color
,
borderColor
}
=
getTagColorsFromName
(
name
);
const
getStyles
=
stylesFactory
(()
=>
(
{
return
{
itemStyle
:
css
`
background-color:
${
color
}
;
color:
${
theme
.
colors
.
white
}
;
border: 1px solid
${
borderColor
}
;
border-radius: 3px;
padding: 3px 6px;
...
...
@@ -37,12 +39,17 @@ export const TagItem: FC<Props> = ({ name, onRemove }) => {
cursor: pointer;
`
,
]),
}));
};
});
export
const
TagItem
:
FC
<
Props
>
=
({
name
,
onRemove
})
=>
{
const
theme
=
useTheme
();
const
styles
=
getStyles
({
theme
,
name
});
return
(
<
div
className=
{
getStyles
()
.
itemStyle
}
>
<
span
className=
{
getStyles
()
.
nameStyle
}
>
{
name
}
</
span
>
<
i
className=
{
getStyles
()
.
removeStyle
}
onClick=
{
()
=>
onRemove
(
name
)
}
/>
<
div
className=
{
styles
.
itemStyle
}
>
<
span
className=
{
styles
.
nameStyle
}
>
{
name
}
</
span
>
<
i
className=
{
styles
.
removeStyle
}
onClick=
{
()
=>
onRemove
(
name
)
}
/>
</
div
>
);
};
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