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
79fd8a7e
Commit
79fd8a7e
authored
Jan 07, 2019
by
Johannes Schill
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add "theme" to Tooltip
parent
dadbaccf
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
19 deletions
+42
-19
public/app/core/components/Tooltip/Popper.tsx
+10
-2
public/app/core/components/Tooltip/withPopper.tsx
+2
-1
public/app/features/dashboard/dashgrid/DataPanel.tsx
+5
-3
public/sass/_variables.dark.scss
+4
-2
public/sass/_variables.light.scss
+4
-2
public/sass/components/_popper.scss
+17
-9
No files found.
public/app/core/components/Tooltip/Popper.tsx
View file @
79fd8a7e
...
...
@@ -21,13 +21,21 @@ interface Props {
placement
?:
any
;
content
:
string
|
((
props
:
any
)
=>
JSX
.
Element
);
refClassName
?:
string
;
theme
?:
string
;
}
export
enum
Themes
{
Default
=
'popper__background--default'
,
Error
=
'popper__background--error'
,
}
class
Popper
extends
PureComponent
<
Props
>
{
render
()
{
const
{
children
,
renderContent
,
show
,
placement
,
refClassName
}
=
this
.
props
;
const
{
children
,
renderContent
,
show
,
placement
,
refClassName
,
theme
}
=
this
.
props
;
const
{
content
}
=
this
.
props
;
const
popperBackgroundClassName
=
'popper__background'
+
(
theme
?
' '
+
theme
:
''
);
return
(
<
Manager
>
<
Reference
>
...
...
@@ -53,7 +61,7 @@ class Popper extends PureComponent<Props> {
data
-
placement=
{
placement
}
className=
"popper"
>
<
div
className=
"popper__background"
>
<
div
className=
{
popperBackgroundClassName
}
>
{
renderContent
(
content
)
}
<
div
ref=
{
arrowProps
.
ref
}
data
-
placement=
{
placement
}
className=
"popper__arrow"
/>
</
div
>
...
...
public/app/core/components/Tooltip/withPopper.tsx
View file @
79fd8a7e
...
...
@@ -9,6 +9,7 @@ export interface UsingPopperProps {
content
:
string
|
((
props
:
any
)
=>
JSX
.
Element
);
className
?:
string
;
refClassName
?:
string
;
theme
?:
string
;
}
interface
Props
{
...
...
@@ -16,6 +17,7 @@ interface Props {
className
?:
string
;
refClassName
?:
string
;
content
:
string
|
((
props
:
any
)
=>
JSX
.
Element
);
theme
?:
string
;
}
interface
State
{
...
...
@@ -71,7 +73,6 @@ export default function withPopper(WrappedComponent) {
render
()
{
const
{
show
,
placement
}
=
this
.
state
;
const
className
=
this
.
props
.
className
||
''
;
return
(
<
WrappedComponent
{
...
this
.
props
}
...
...
public/app/features/dashboard/dashgrid/DataPanel.tsx
View file @
79fd8a7e
...
...
@@ -11,6 +11,7 @@ import kbn from 'app/core/utils/kbn';
// Types
import
{
DataQueryOptions
,
DataQueryResponse
}
from
'app/types'
;
import
{
TimeRange
,
TimeSeries
,
LoadingState
}
from
'@grafana/ui'
;
import
{
Themes
}
from
'app/core/components/Tooltip/Popper'
;
interface
RenderProps
{
loading
:
LoadingState
;
...
...
@@ -140,7 +141,7 @@ export class DataPanel extends Component<Props, State> {
const
timeSeries
=
response
.
data
;
if
(
isFirstLoad
&&
loading
===
LoadingState
.
Loading
)
{
return
this
.
renderLoadingState
();
return
this
.
renderLoadingState
s
();
}
if
(
!
queries
.
length
)
{
...
...
@@ -153,7 +154,7 @@ export class DataPanel extends Component<Props, State> {
return
(
<>
{
this
.
renderLoadingState
()
}
{
this
.
renderLoadingState
s
()
}
{
this
.
props
.
children
({
timeSeries
,
loading
,
...
...
@@ -162,7 +163,7 @@ export class DataPanel extends Component<Props, State> {
);
}
private
renderLoadingState
():
JSX
.
Element
{
private
renderLoadingState
s
():
JSX
.
Element
{
const
{
loading
}
=
this
.
state
;
if
(
loading
===
LoadingState
.
Loading
)
{
return
(
...
...
@@ -177,6 +178,7 @@ export class DataPanel extends Component<Props, State> {
className=
"popper__manager--block"
refClassName=
{
`panel-info-corner panel-info-corner--error`
}
placement=
"bottom-start"
theme=
{
Themes
.
Error
}
>
<
i
className=
"fa"
/>
<
span
className=
"panel-info-corner-inner"
/>
...
...
public/sass/_variables.dark.scss
View file @
79fd8a7e
...
...
@@ -302,12 +302,14 @@ $popover-error-bg: $btn-danger-bg;
// Tooltips and popovers
// -------------------------
$tooltipColor
:
$popover-help-color
;
$tooltipBackground
:
$popover-help-bg
;
$tooltipArrowWidth
:
5px
;
$tooltipArrowColor
:
$tooltipBackground
;
$tooltipLinkColor
:
$link-color
;
$graph-tooltip-bg
:
$dark-1
;
$tooltipBackground
:
$popover-help-bg
;
$tooltipArrowColor
:
$tooltipBackground
;
$tooltipBackgroundError
:
$brand-danger
;
// images
$checkboxImageUrl
:
'../img/checkbox.png'
;
...
...
public/sass/_variables.light.scss
View file @
79fd8a7e
...
...
@@ -307,12 +307,14 @@ $popover-error-bg: $btn-danger-bg;
// Tooltips and popovers
// -------------------------
$tooltipColor
:
$popover-help-color
;
$tooltipBackground
:
$popover-help-bg
;
$tooltipArrowWidth
:
5px
;
$tooltipArrowColor
:
$tooltipBackground
;
$tooltipLinkColor
:
lighten
(
$popover-help-color
,
5%
);
$graph-tooltip-bg
:
$gray-5
;
$tooltipBackground
:
$popover-help-bg
;
$tooltipArrowColor
:
$tooltipBackground
;
// Used by Angular tooltip
$tooltipBackgroundError
:
$brand-danger
;
// images
$checkboxImageUrl
:
'../img/checkbox_white.png'
;
...
...
public/sass/components/_popper.scss
View file @
79fd8a7e
...
...
@@ -8,7 +8,22 @@ $popper-margin-from-ref: 5px;
text-align
:
center
;
}
.popper
.popper__arrow
{
.popper__background
{
background
:
$tooltipBackground
;
border-radius
:
$border-radius
;
box-shadow
:
0
0
2px
rgba
(
0
,
0
,
0
,
0
.5
);
padding
:
10px
;
// Themes
&
.popper__background--error
{
background
:
$tooltipBackgroundError
;
.popper__arrow
{
border-color
:
$tooltipBackgroundError
;
}
}
}
.popper__arrow
{
width
:
0
;
height
:
0
;
border-style
:
solid
;
...
...
@@ -16,17 +31,10 @@ $popper-margin-from-ref: 5px;
margin
:
0px
;
}
.popper
.popper
__arrow
{
.popper__arrow
{
border-color
:
$tooltipBackground
;
}
.popper__background
{
background
:
$tooltipBackground
;
border-radius
:
$border-radius
;
box-shadow
:
0
0
2px
rgba
(
0
,
0
,
0
,
0
.5
);
padding
:
10px
;
}
// Top
.popper
[
data-placement
^=
'top'
]
{
padding-bottom
:
$popper-margin-from-ref
;
...
...
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