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
35ef51dc
Commit
35ef51dc
authored
Sep 07, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring: custom scrollbars PR updated, #13175
parent
1415bed0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
16 deletions
+21
-16
public/app/core/components/CustomScrollbar/CustomScrollbar.test.tsx
+4
-4
public/app/core/components/CustomScrollbar/CustomScrollbar.tsx
+10
-11
public/app/core/components/CustomScrollbar/__snapshots__/CustomScrollbar.test.tsx.snap
+1
-1
yarn.lock
+6
-0
No files found.
public/app/core/components/
ScrollBar/Grafana
Scrollbar.test.tsx
→
public/app/core/components/
CustomScrollbar/Custom
Scrollbar.test.tsx
View file @
35ef51dc
import
React
from
'react'
;
import
renderer
from
'react-test-renderer'
;
import
GrafanaScrollbar
from
'./Grafana
Scrollbar'
;
import
CustomScrollbar
from
'./Custom
Scrollbar'
;
describe
(
'
Grafana
Scrollbar'
,
()
=>
{
describe
(
'
Custom
Scrollbar'
,
()
=>
{
it
(
'renders correctly'
,
()
=>
{
const
tree
=
renderer
.
create
(
<
Grafana
Scrollbar
>
<
Custom
Scrollbar
>
<
p
>
Scrollable content
</
p
>
</
Grafana
Scrollbar
>
</
Custom
Scrollbar
>
)
.
toJSON
();
expect
(
tree
).
toMatchSnapshot
();
...
...
public/app/core/components/
ScrollBar/Grafana
Scrollbar.tsx
→
public/app/core/components/
CustomScrollbar/Custom
Scrollbar.tsx
View file @
35ef51dc
import
React
from
'react'
;
import
React
,
{
PureComponent
}
from
'react'
;
import
Scrollbars
from
'react-custom-scrollbars'
;
interface
GrafanaScrollBar
Props
{
interface
Props
{
customClassName
?:
string
;
autoHide
?:
boolean
;
autoHideTimeout
?:
number
;
...
...
@@ -9,19 +9,18 @@ interface GrafanaScrollBarProps {
hideTracksWhenNotNeeded
?:
boolean
;
}
const
grafanaScrollBarDefaultProps
:
Partial
<
GrafanaScrollBarProps
>
=
{
/**
* Wraps component into <Scrollbars> component from `react-custom-scrollbars`
*/
class
CustomScrollbar
extends
PureComponent
<
Props
>
{
static
defaultProps
:
Partial
<
Props
>
=
{
customClassName
:
'custom-scrollbars'
,
autoHide
:
true
,
autoHideTimeout
:
200
,
autoHideDuration
:
200
,
hideTracksWhenNotNeeded
:
false
,
};
/**
* Wraps component into <Scrollbars> component from `react-custom-scrollbars`
*/
class
GrafanaScrollbar
extends
React
.
Component
<
GrafanaScrollBarProps
>
{
static
defaultProps
=
grafanaScrollBarDefaultProps
;
};
render
()
{
const
{
customClassName
,
children
,
...
scrollProps
}
=
this
.
props
;
...
...
@@ -45,4 +44,4 @@ class GrafanaScrollbar extends React.Component<GrafanaScrollBarProps> {
}
}
export
default
Grafana
Scrollbar
;
export
default
Custom
Scrollbar
;
public/app/core/components/
ScrollBar/__snapshots__/Grafana
Scrollbar.test.tsx.snap
→
public/app/core/components/
CustomScrollbar/__snapshots__/Custom
Scrollbar.test.tsx.snap
View file @
35ef51dc
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`
Grafana
Scrollbar renders correctly 1`] = `
exports[`
Custom
Scrollbar renders correctly 1`] = `
<div
className="custom-scrollbars"
style={
...
...
yarn.lock
View file @
35ef51dc
...
...
@@ -240,6 +240,12 @@
version "8.10.17"
resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.17.tgz#d48cf10f0dc6dcf59f827f5a3fc7a4a6004318d3"
"@types/react-custom-scrollbars@^4.0.5":
version "4.0.5"
resolved "https://registry.yarnpkg.com/@types/react-custom-scrollbars/-/react-custom-scrollbars-4.0.5.tgz#8629b4b3164914d27df7cb0ca0a086c0ad406389"
dependencies:
"@types/react" "*"
"@types/react-dom@^16.0.3":
version "16.0.6"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-16.0.6.tgz#f1a65a4e7be8ed5d123f8b3b9eacc913e35a1a3c"
...
...
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