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
3c7a5bdf
Commit
3c7a5bdf
authored
Jan 23, 2019
by
Dominik Prokop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update styles of selected named color swatch
parent
8cce80a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
packages/grafana-ui/src/components/ColorPicker/NamedColorsGroup.tsx
+6
-3
packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.tsx
+0
-1
No files found.
packages/grafana-ui/src/components/ColorPicker/NamedColorsGroup.tsx
View file @
3c7a5bdf
import
React
,
{
FunctionComponent
}
from
'react'
;
import
{
Themeable
}
from
'../../types'
;
import
{
Themeable
,
GrafanaTheme
}
from
'../../types'
;
import
{
ColorDefinition
,
getColorForTheme
}
from
'../../utils/colorsPalette'
;
import
{
Color
}
from
'csstype'
;
import
{
find
,
upperFirst
}
from
'lodash'
;
...
...
@@ -11,7 +11,7 @@ export enum ColorSwatchVariant {
Large
=
'large'
,
}
interface
ColorSwatchProps
extends
React
.
DOMAttributes
<
HTMLDivElement
>
{
interface
ColorSwatchProps
extends
Themeable
,
React
.
DOMAttributes
<
HTMLDivElement
>
{
color
:
string
;
label
?:
string
;
variant
?:
ColorSwatchVariant
;
...
...
@@ -23,17 +23,19 @@ const ColorSwatch: FunctionComponent<ColorSwatchProps> = ({
label
,
variant
=
ColorSwatchVariant
.
Small
,
isSelected
,
theme
,
...
otherProps
})
=>
{
const
isSmall
=
variant
===
ColorSwatchVariant
.
Small
;
const
swatchSize
=
isSmall
?
'16px'
:
'32px'
;
const
selectedSwatchBorder
=
theme
===
GrafanaTheme
.
Light
?
'#ffffff'
:
'#1A1B1F'
;
const
swatchStyles
=
{
width
:
swatchSize
,
height
:
swatchSize
,
borderRadius
:
'50%'
,
background
:
`
${
color
}
`
,
marginRight
:
isSmall
?
'0px'
:
'8px'
,
boxShadow
:
isSelected
?
`inset 0 0 0 2px
${
color
}
, inset 0 0 0 4px
white
`
:
'none'
,
boxShadow
:
isSelected
?
`inset 0 0 0 2px
${
color
}
, inset 0 0 0 4px
${
selectedSwatchBorder
}
`
:
'none'
,
cursor
:
isSelected
?
'default'
:
'pointer'
,
};
...
...
@@ -76,6 +78,7 @@ const NamedColorsGroup: FunctionComponent<NamedColorsGroupProps> = ({
color=
{
getColorForTheme
(
primaryColor
,
theme
)
}
label=
{
upperFirst
(
primaryColor
.
hue
)
}
onClick=
{
()
=>
onColorSelect
(
primaryColor
)
}
theme=
{
theme
}
/>
)
}
<
div
...
...
packages/grafana-ui/src/components/ColorPicker/NamedColorsPalette.tsx
View file @
3c7a5bdf
...
...
@@ -10,7 +10,6 @@ interface NamedColorsPaletteProps extends Themeable {
const
NamedColorsPalette
=
({
color
,
onChange
,
theme
}:
NamedColorsPaletteProps
)
=>
{
const
swatches
:
JSX
.
Element
[]
=
[];
ColorsPalette
.
forEach
((
colors
,
hue
)
=>
{
swatches
.
push
(
<
NamedColorsGroup
...
...
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