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
e7917ce4
Commit
e7917ce4
authored
Feb 07, 2019
by
Dominik Prokop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed unnecessary code from ColorPicker and extended theme type
parent
5ba3b0aa
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
20 deletions
+37
-20
packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx
+3
-16
packages/grafana-ui/src/themes/dark.js
+8
-3
packages/grafana-ui/src/themes/default.js
+15
-0
packages/grafana-ui/src/themes/light.js
+5
-0
packages/grafana-ui/src/types/theme.ts
+6
-1
No files found.
packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx
View file @
e7917ce4
import
React
,
{
Component
,
createRef
}
from
'react'
;
import
PopperController
from
'../Tooltip/PopperController'
;
import
Popper
,
{
RenderPopperArrowFn
}
from
'../Tooltip/Popper'
;
import
Popper
from
'../Tooltip/Popper'
;
import
{
ColorPickerPopover
}
from
'./ColorPickerPopover'
;
import
{
GrafanaThemeType
,
Themeable
}
from
'../../types'
;
import
{
Themeable
}
from
'../../types'
;
import
{
getColorFromHexRgbOrName
}
from
'../../utils/namedColorsPalette'
;
import
{
SeriesColorPickerPopover
}
from
'./SeriesColorPickerPopover'
;
import
propDeprecationWarning
from
'../../utils/propDeprecationWarning'
;
...
...
@@ -18,7 +18,6 @@ export interface ColorPickerProps extends Themeable {
*/
onColorChange
?:
ColorPickerChangeHandler
;
enableNamedColors
?:
boolean
;
withArrow
?:
boolean
;
children
?:
JSX
.
Element
;
}
...
...
@@ -32,7 +31,6 @@ export const warnAboutColorPickerPropsDeprecation = (componentName: string, prop
export
const
colorPickerFactory
=
<
T
extends
ColorPickerProps
>
(
popover: React.ComponentType
<
T
>
,
displayName = 'ColorPicker',
renderPopoverArrowFunction?: RenderPopperArrowFn
) =
>
{
return
class
ColorPicker
extends
Component
<
T
,
any
>
{
static
displayName
=
displayName
;
...
...
@@ -50,17 +48,7 @@ export const colorPickerFactory = <T extends ColorPickerProps>(
...
this
.
props
,
onChange
:
this
.
handleColorChange
,
});
const
{
theme
,
withArrow
,
children
}
=
this
.
props
;
const
renderArrow
:
RenderPopperArrowFn
=
({
arrowProps
,
placement
})
=>
{
return
(
<
div
{
...
arrowProps
}
data
-
placement=
{
placement
}
className=
{
`ColorPicker__arrow ColorPicker__arrow--${theme.type === GrafanaThemeType.Light ? 'light' : 'dark'}`
}
/>
);
};
const
{
theme
,
children
}
=
this
.
props
;
return
(
<
PopperController
content=
{
popoverElement
}
hideAfter=
{
300
}
>
...
...
@@ -72,7 +60,6 @@ export const colorPickerFactory = <T extends ColorPickerProps>(
{
...
popperProps
}
referenceElement=
{
this
.
pickerTriggerRef
.
current
}
wrapperClassName=
"ColorPicker"
renderArrow=
{
withArrow
&&
(
renderPopoverArrowFunction
||
renderArrow
)
}
onMouseLeave=
{
hidePopper
}
onMouseEnter=
{
showPopper
}
/>
...
...
packages/grafana-ui/src/themes/dark.js
View file @
e7917ce4
...
...
@@ -33,7 +33,7 @@ const darkTheme = {
...
defaultTheme
,
type
:
'dark'
,
name
:
'Grafana Dark'
,
colors
:
{
colors
:
{
...
basicColors
,
inputBlack
:
'#09090b'
,
queryRed
:
'#e24d42'
,
...
...
@@ -57,7 +57,12 @@ const darkTheme = {
linkColorHover
:
basicColors
.
white
,
linkColorExternal
:
basicColors
.
blue
,
headingColor
:
new
tinycolor
(
basicColors
.
white
).
darken
(
11
).
toString
(),
}
}
},
background
:
{
dropdown
:
basicColors
.
dark3
,
scrollbar
:
'#aeb5df'
,
scrollbar2
:
'#3a3a3a'
,
},
};
module
.
exports
=
darkTheme
;
packages/grafana-ui/src/themes/default.js
View file @
e7917ce4
...
...
@@ -41,6 +41,21 @@ const theme = {
m
:
'768px'
,
l
:
'992px'
,
xl
:
'1200px'
},
spacing
:
{
xs
:
'0'
,
s
:
'0.2rem'
,
m
:
'1rem'
,
l
:
'1.5rem'
,
xl
:
'3rem'
,
gutter
:
'30px'
,
},
border
:
{
radius
:
{
xs
:
'2px'
,
s
:
'3px'
,
m
:
'5px'
,
}
}
};
...
...
packages/grafana-ui/src/themes/light.js
View file @
e7917ce4
...
...
@@ -60,6 +60,11 @@ const lightTheme/*: GrafanaThemeType*/ = {
linkColorHover
:
new
tinycolor
(
basicColors
.
gray1
).
darken
(
20
).
toString
(),
linkColorExternal
:
basicColors
.
blueLight
,
headingColor
:
basicColors
.
gray1
,
},
background
:
{
dropdown
:
basicColors
.
white
,
scrollbar
:
basicColors
.
gray5
,
scrollbar2
:
basicColors
.
gray5
,
}
}
...
...
packages/grafana-ui/src/types/theme.ts
View file @
e7917ce4
...
...
@@ -62,6 +62,11 @@ export interface GrafanaTheme {
m
:
string
;
};
};
background
:
{
dropdown
:
string
;
scrollbar
:
string
;
scrollbar2
:
string
;
};
colors
:
{
black
:
string
;
white
:
string
;
...
...
@@ -102,7 +107,7 @@ export interface GrafanaTheme {
warn
:
string
;
critical
:
string
;
// TODO:
should this be a part of theme?
// TODO:
move to background section
bodyBg
:
string
;
pageBg
:
string
;
bodyColor
:
string
;
...
...
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