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
4a2905de
Commit
4a2905de
authored
Mar 11, 2019
by
Andrej Ocenas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move ColorPicker trigger to separate component and cleanup css
parent
d6bab53d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
66 deletions
+60
-66
packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx
+4
-12
packages/grafana-ui/src/components/ColorPicker/ColorPickerTrigger.tsx
+56
-0
packages/grafana-ui/src/components/ColorPicker/_ColorPicker.scss
+0
-53
packages/grafana-ui/src/components/ThresholdsEditor/_ThresholdsEditor.scss
+0
-1
No files found.
packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx
View file @
4a2905de
...
...
@@ -6,6 +6,7 @@ import { getColorFromHexRgbOrName } from '../../utils/namedColorsPalette';
import
{
SeriesColorPickerPopover
}
from
'./SeriesColorPickerPopover'
;
import
{
withTheme
}
from
'../../themes/ThemeContext'
;
import
{
ColorPickerTrigger
}
from
'./ColorPickerTrigger'
;
export
const
colorPickerFactory
=
<
T
extends
ColorPickerProps
>
(
popover: React.ComponentType
<
T
>
,
...
...
@@ -51,21 +52,12 @@ export const colorPickerFactory = <T extends ColorPickerProps>(
onMouseLeave
:
hidePopper
,
})
)
:
(
<
div
<
ColorPickerTrigger
ref=
{
this
.
pickerTriggerRef
}
onClick=
{
showPopper
}
onMouseLeave=
{
hidePopper
}
className=
"sp-replacer sp-light"
>
<
div
className=
"sp-preview"
>
<
div
className=
"sp-preview-inner"
style=
{
{
backgroundColor
:
getColorFromHexRgbOrName
(
this
.
props
.
color
||
'#000000'
,
theme
.
type
),
}
}
/>
</
div
>
</
div
>
color=
{
getColorFromHexRgbOrName
(
this
.
props
.
color
||
'#000000'
,
theme
.
type
)
}
/>
)
}
</>
);
...
...
packages/grafana-ui/src/components/ColorPicker/ColorPickerTrigger.tsx
0 → 100644
View file @
4a2905de
import
React
,
{
forwardRef
,
Ref
}
from
'react'
;
interface
ColorPickerTriggerProps
{
onClick
:
()
=>
void
;
onMouseLeave
:
()
=>
void
;
color
:
string
;
}
export
const
ColorPickerTrigger
=
forwardRef
(
function
ColorPickerTrigger
(
props
:
ColorPickerTriggerProps
,
ref
:
Ref
<
HTMLDivElement
>
)
{
return
(
<
div
ref=
{
ref
}
onClick=
{
props
.
onClick
}
onMouseLeave=
{
props
.
onMouseLeave
}
style=
{
{
overflow
:
'hidden'
,
background
:
'inherit'
,
border
:
'none'
,
color
:
'inherit'
,
padding
:
0
,
borderRadius
:
10
,
cursor
:
'pointer'
,
}
}
>
<
div
style=
{
{
position
:
'relative'
,
width
:
15
,
height
:
15
,
border
:
'none'
,
margin
:
0
,
float
:
'left'
,
zIndex
:
0
,
backgroundImage
:
// tslint:disable-next-line:max-line-length
'url(data:image/png,base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)'
,
}
}
>
<
div
style=
{
{
backgroundColor
:
props
.
color
,
display
:
'block'
,
position
:
'absolute'
,
top
:
0
,
left
:
0
,
bottom
:
0
,
right
:
0
,
}
}
/>
</
div
>
</
div
>
);
});
packages/grafana-ui/src/components/ColorPicker/_ColorPicker.scss
View file @
4a2905de
...
...
@@ -161,59 +161,6 @@ $arrowSize: 15px;
flex-grow
:
1
;
}
.sp-replacer
{
background
:
inherit
;
border
:
none
;
color
:
inherit
;
padding
:
0
;
border-radius
:
10px
;
cursor
:
pointer
;
}
.sp-replacer
:hover
,
.sp-replacer.sp-active
{
border-color
:
inherit
;
color
:
inherit
;
}
.sp-container
{
border-radius
:
0
;
background-color
:
$dropdownBackground
;
border
:
none
;
padding
:
0
;
}
.sp-palette-container
,
.sp-picker-container
{
border
:
none
;
}
.sp-dd
{
display
:
none
;
}
.sp-preview
{
position
:
relative
;
width
:
15px
;
height
:
15px
;
border
:
none
;
margin
:
0
;
float
:
left
;
z-index
:
0
;
background-image
:
url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)
;
}
.sp-preview-inner
,
.sp-alpha-inner
,
.sp-thumb-inner
{
display
:
block
;
position
:
absolute
;
top
:
0
;
left
:
0
;
bottom
:
0
;
right
:
0
;
}
.gf-color-picker__body
{
padding-bottom
:
$arrowSize
;
padding-left
:
6px
;
...
...
packages/grafana-ui/src/components/ThresholdsEditor/_ThresholdsEditor.scss
View file @
4a2905de
...
...
@@ -86,7 +86,6 @@
.thresholds-row-input-inner-color-colorpicker
{
border-radius
:
10px
;
overflow
:
hidden
;
display
:
flex
;
align-items
:
center
;
box-shadow
:
0
1px
4px
rgba
(
0
,
0
,
0
,
0
.25
);
...
...
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