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
6d3e6b1f
Commit
6d3e6b1f
authored
Jan 16, 2019
by
Dominik Prokop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Experimenting with generating doc for ui component
parent
2991b64b
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
83 additions
and
18 deletions
+83
-18
packages/grafana-ui/.storybook/config.ts
+3
-2
packages/grafana-ui/.storybook/webpack.config.js
+17
-0
packages/grafana-ui/package.json
+4
-2
packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx
+25
-0
packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx
+10
-3
packages/grafana-ui/src/components/DeleteButton/DeleteButton.story.tsx
+24
-0
packages/grafana-ui/stories/Test.story.tsx
+0
-11
public/sass/_grafana.scss
+0
-0
yarn.lock
+0
-0
No files found.
packages/grafana-ui/.storybook/config.ts
View file @
6d3e6b1f
import
{
configure
}
from
'@storybook/react'
;
import
{
configure
}
from
'@storybook/react'
;
import
'../../../public/sass/grafana.dark.scss'
;
import
'@grafana/ui/src/components/index.scss'
;
// automatically import all files ending in *.stories.tsx
// automatically import all files ending in *.stories.tsx
const
req
=
require
.
context
(
'../s
torie
s'
,
true
,
/.story.tsx$/
);
const
req
=
require
.
context
(
'../s
rc/component
s'
,
true
,
/.story.tsx$/
);
function
loadStories
()
{
function
loadStories
()
{
req
.
keys
().
forEach
(
req
);
req
.
keys
().
forEach
(
req
);
...
...
packages/grafana-ui/.storybook/webpack.config.js
View file @
6d3e6b1f
const
path
=
require
(
'path'
);
const
path
=
require
(
'path'
);
module
.
exports
=
(
baseConfig
,
env
,
config
)
=>
{
module
.
exports
=
(
baseConfig
,
env
,
config
)
=>
{
config
.
module
.
rules
.
push
({
config
.
module
.
rules
.
push
({
test
:
/
\.(
ts|tsx
)
$/
,
test
:
/
\.(
ts|tsx
)
$/
,
use
:
[
use
:
[
...
@@ -9,6 +10,7 @@ module.exports = (baseConfig, env, config) => {
...
@@ -9,6 +10,7 @@ module.exports = (baseConfig, env, config) => {
},
},
],
],
});
});
config
.
module
.
rules
.
push
({
config
.
module
.
rules
.
push
({
test
:
/
\.
scss$/
,
test
:
/
\.
scss$/
,
use
:
[
use
:
[
...
@@ -34,6 +36,21 @@ module.exports = (baseConfig, env, config) => {
...
@@ -34,6 +36,21 @@ module.exports = (baseConfig, env, config) => {
{
loader
:
'sass-loader'
,
options
:
{
sourceMap
:
false
}
},
{
loader
:
'sass-loader'
,
options
:
{
sourceMap
:
false
}
},
],
],
});
});
config
.
module
.
rules
.
push
({
test
:
require
.
resolve
(
'jquery'
),
use
:
[
{
loader
:
'expose-loader'
,
query
:
'jQuery'
,
},
{
loader
:
'expose-loader'
,
query
:
'$'
,
},
],
});
config
.
resolve
.
extensions
.
push
(
'.ts'
,
'.tsx'
);
config
.
resolve
.
extensions
.
push
(
'.ts'
,
'.tsx'
);
return
config
;
return
config
;
};
};
packages/grafana-ui/package.json
View file @
6d3e6b1f
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
"
tinycolor2
"
:
"^1.4.1"
"
tinycolor2
"
:
"^1.4.1"
},
},
"devDependencies"
:
{
"devDependencies"
:
{
"
@storybook/addon-info
"
:
"^4.1.
4
"
,
"
@storybook/addon-info
"
:
"^4.1.
6
"
,
"
@storybook/react
"
:
"^4.1.4"
,
"
@storybook/react
"
:
"^4.1.4"
,
"
@types/classnames
"
:
"^2.2.6"
,
"
@types/classnames
"
:
"^2.2.6"
,
"
@types/jest
"
:
"^23.3.2"
,
"
@types/jest
"
:
"^23.3.2"
,
...
@@ -36,13 +36,15 @@
...
@@ -36,13 +36,15 @@
"
@types/lodash
"
:
"^4.14.119"
,
"
@types/lodash
"
:
"^4.14.119"
,
"
@types/node
"
:
"^10.12.18"
,
"
@types/node
"
:
"^10.12.18"
,
"
@types/react
"
:
"^16.7.6"
,
"
@types/react
"
:
"^16.7.6"
,
"
@types/storybook__react
"
:
"^4.0.0"
,
"
@types/react-custom-scrollbars
"
:
"^4.0.5"
,
"
@types/react-custom-scrollbars
"
:
"^4.0.5"
,
"
@types/react-test-renderer
"
:
"^16.0.3"
,
"
@types/react-test-renderer
"
:
"^16.0.3"
,
"
@types/react-transition-group
"
:
"^2.0.15"
,
"
@types/react-transition-group
"
:
"^2.0.15"
,
"
@types/storybook__addon-info
"
:
"^3.4.2"
,
"
@types/storybook__react
"
:
"^4.0.0"
,
"
@types/tether-drop
"
:
"^1.4.8"
,
"
@types/tether-drop
"
:
"^1.4.8"
,
"
@types/tinycolor2
"
:
"^1.4.1"
,
"
@types/tinycolor2
"
:
"^1.4.1"
,
"
awesome-typescript-loader
"
:
"^5.2.1"
,
"
awesome-typescript-loader
"
:
"^5.2.1"
,
"
react-docgen-typescript-loader
"
:
"^3.0.0"
,
"
react-docgen-typescript-webpack-plugin
"
:
"^1.1.0"
,
"
react-docgen-typescript-webpack-plugin
"
:
"^1.1.0"
,
"
react-test-renderer
"
:
"^16.7.0"
,
"
react-test-renderer
"
:
"^16.7.0"
,
"
typescript
"
:
"^3.2.2"
"
typescript
"
:
"^3.2.2"
...
...
packages/grafana-ui/src/components/ColorPicker/ColorPicker.story.tsx
0 → 100644
View file @
6d3e6b1f
import
React
,
{
FunctionComponent
}
from
'react'
;
import
{
storiesOf
}
from
'@storybook/react'
;
import
{
ColorPicker
}
from
'@grafana/ui'
;
import
{
withInfo
}
from
'@storybook/addon-info'
;
const
CenteredStory
:
FunctionComponent
<
{}
>
=
({
children
})
=>
{
return
(
<
div
style=
{
{
height
:
'100vh '
,
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
}
}
>
{
children
}
</
div
>
);
};
storiesOf
(
'UI/ColorPicker'
,
module
)
.
addDecorator
(
story
=>
<
CenteredStory
>
{
story
()
}
</
CenteredStory
>)
.
add
(
'default'
,
withInfo
({
inline
:
true
})(()
=>
{
return
<
ColorPicker
color=
"#ff0000"
onChange=
{
()
=>
{}
}
/>;
}));
packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx
View file @
6d3e6b1f
import
React
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
ReactDOM
from
'react-dom'
;
import
ReactDOM
from
'react-dom'
;
import
Drop
from
'tether-drop'
;
import
Drop
from
'tether-drop'
;
import
{
ColorPickerPopover
}
from
'./ColorPickerPopover'
;
import
{
ColorPickerPopover
}
from
'./ColorPickerPopover'
;
export
interface
Props
{
interface
Props
{
/**
* Value to display, either empty (" ") or "X" / "O".
*
* @default " "
**/
color
:
string
;
color
:
string
;
onChange
:
(
c
:
string
)
=>
void
;
onChange
:
(
c
:
string
)
=>
void
;
}
}
export
class
ColorPicker
extends
React
.
Component
<
Props
,
any
>
{
export
class
ColorPicker
extends
Component
<
Props
,
any
>
{
pickerElem
:
HTMLElement
|
null
;
pickerElem
:
HTMLElement
|
null
;
colorPickerDrop
:
any
;
colorPickerDrop
:
any
;
...
@@ -59,3 +64,5 @@ export class ColorPicker extends React.Component<Props, any> {
...
@@ -59,3 +64,5 @@ export class ColorPicker extends React.Component<Props, any> {
);
);
}
}
}
}
export
default
ColorPicker
;
packages/grafana-ui/src/components/DeleteButton/DeleteButton.story.tsx
0 → 100644
View file @
6d3e6b1f
import
React
,
{
FunctionComponent
}
from
'react'
;
import
{
storiesOf
}
from
'@storybook/react'
;
import
{
DeleteButton
}
from
'@grafana/ui'
;
const
CenteredStory
:
FunctionComponent
<
{}
>
=
({
children
})
=>
{
return
(
<
div
style=
{
{
height
:
'100vh '
,
display
:
'flex'
,
alignItems
:
'center'
,
justifyContent
:
'center'
,
}
}
>
{
children
}
</
div
>
);
};
storiesOf
(
'UI/DeleteButton'
,
module
)
.
addDecorator
(
story
=>
<
CenteredStory
>
{
story
()
}
</
CenteredStory
>)
.
add
(
'default'
,
()
=>
{
return
<
DeleteButton
onConfirm=
{
()
=>
{}
}
/>;
});
packages/grafana-ui/stories/Test.story.tsx
deleted
100644 → 0
View file @
2991b64b
import
React
from
'react'
;
import
{
storiesOf
}
from
'@storybook/react'
;
import
{
DeleteButton
}
from
'@grafana/ui'
;
storiesOf
(
'Test story'
,
module
)
.
addDecorator
((
story
)
=>
(
<
div
style=
{
{
padding
:
'20px'
}
}
>
{
story
()
}
</
div
>
))
.
add
(
'with text'
,
()
=>
{
return
<
DeleteButton
onConfirm=
{
()
=>
{
}
}
></
DeleteButton
>;
});
public/sass/_grafana.scss
View file @
6d3e6b1f
yarn.lock
View file @
6d3e6b1f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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