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
b00755a2
Unverified
Commit
b00755a2
authored
Oct 03, 2020
by
Zoltán Bedi
Committed by
GitHub
Oct 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix errors in grafana-ui's storybook files (#28004)
parent
6173aa70
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
38 additions
and
41 deletions
+38
-41
.eslintrc
+1
-1
packages/grafana-ui/src/components/FileUpload/FileUpload.story.tsx
+1
-1
packages/grafana-ui/src/components/Forms/Checkbox.story.tsx
+1
-1
packages/grafana-ui/src/components/Forms/Field.story.tsx
+2
-2
packages/grafana-ui/src/components/Forms/Form.story.tsx
+3
-3
packages/grafana-ui/src/components/Forms/Legacy/Select/Select.story.internal.tsx
+11
-14
packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.story.tsx
+2
-2
packages/grafana-ui/src/components/Icon/Icon.story.tsx
+1
-1
packages/grafana-ui/src/components/IconButton/IconButton.story.tsx
+1
-1
packages/grafana-ui/src/components/Input/Input.story.tsx
+2
-2
packages/grafana-ui/src/components/Modal/Modal.story.tsx
+1
-1
packages/grafana-ui/src/components/Select/Select.story.tsx
+10
-10
packages/grafana-ui/src/components/Switch/Switch.story.tsx
+2
-2
No files found.
.eslintrc
View file @
b00755a2
...
...
@@ -3,7 +3,7 @@
"root": true,
"overrides": [
{
"files": ["packages/grafana-ui/**/*.{ts,tsx}", "public/app/**/*.{ts,tsx}"],
"files": ["packages/grafana-ui/**/*
/!(*.story)
.{ts,tsx}", "public/app/**/*.{ts,tsx}"],
"rules": {
"react-hooks/rules-of-hooks": "off",
"react-hooks/exhaustive-deps": "off"
...
...
packages/grafana-ui/src/components/FileUpload/FileUpload.story.tsx
View file @
b00755a2
...
...
@@ -16,7 +16,7 @@ export default {
},
};
export
const
s
ingle
=
()
=>
{
export
const
S
ingle
=
()
=>
{
const
size
=
useSize
();
return
(
<
FileUpload
...
...
packages/grafana-ui/src/components/Forms/Checkbox.story.tsx
View file @
b00755a2
...
...
@@ -12,7 +12,7 @@ export default {
},
};
export
const
c
ontrolled
=
()
=>
{
export
const
C
ontrolled
=
()
=>
{
const
[
checked
,
setChecked
]
=
useState
(
false
);
const
onChange
=
useCallback
(
e
=>
setChecked
(
e
.
currentTarget
.
checked
),
[
setChecked
]);
return
(
...
...
packages/grafana-ui/src/components/Forms/Field.story.tsx
View file @
b00755a2
...
...
@@ -37,7 +37,7 @@ const getKnobs = () => {
return
{
containerWidth
,
disabled
,
invalid
,
loading
,
error
};
};
export
const
s
imple
=
()
=>
{
export
const
S
imple
=
()
=>
{
const
{
containerWidth
,
...
otherProps
}
=
getKnobs
();
return
(
<
div
style=
{
{
width
:
containerWidth
}
}
>
...
...
@@ -48,7 +48,7 @@ export const simple = () => {
);
};
export
const
h
orizontalLayout
=
()
=>
{
export
const
H
orizontalLayout
=
()
=>
{
const
[
checked
,
setChecked
]
=
useState
(
false
);
const
onChange
=
useCallback
(
e
=>
setChecked
(
e
.
currentTarget
.
checked
),
[
setChecked
]);
const
{
containerWidth
,
...
otherProps
}
=
getKnobs
();
...
...
packages/grafana-ui/src/components/Forms/Form.story.tsx
View file @
b00755a2
...
...
@@ -120,11 +120,11 @@ const renderForm = (defaultValues?: Partial<FormDTO>) => (
</
Form
>
);
export
const
b
asic
=
()
=>
{
export
const
B
asic
=
()
=>
{
return
<>
{
renderForm
()
}
</>;
};
export
const
d
efaultValues
=
()
=>
{
export
const
D
efaultValues
=
()
=>
{
const
defaultValues
=
[
{
name
:
'Roger Waters'
,
...
...
@@ -162,7 +162,7 @@ export const defaultValues = () => {
);
};
export
const
a
syncValidation
=
()
=>
{
export
const
A
syncValidation
=
()
=>
{
const
passAsyncValidation
=
boolean
(
'Pass username validation'
,
true
);
return
(
<>
...
...
packages/grafana-ui/src/components/Forms/Legacy/Select/Select.story.internal.tsx
View file @
b00755a2
...
...
@@ -4,7 +4,7 @@ import { withKnobs, object } from '@storybook/addon-knobs';
import
{
withCenteredStory
}
from
'../../../../utils/storybook/withCenteredStory'
;
import
{
UseState
}
from
'../../../../utils/storybook/UseState'
;
import
{
SelectableValue
}
from
'@grafana/data'
;
import
{
Select
,
AsyncSelect
}
from
'./Select'
;
import
{
Select
,
AsyncSelect
as
AsyncSelectComponent
}
from
'./Select'
;
export
default
{
title
:
'Forms/Legacy/Select'
,
...
...
@@ -70,22 +70,19 @@ export const withAllowCustomValue = () => {
);
};
export
const
a
syncSelect
=
()
=>
{
export
const
A
syncSelect
=
()
=>
{
const
[
isLoading
,
setIsLoading
]
=
useState
<
boolean
>
(
true
);
const
[
value
,
setValue
]
=
useState
<
SelectableValue
<
any
>>
();
const
loadAsyncOptions
=
useCallback
(
inputValue
=>
{
return
new
Promise
<
Array
<
SelectableValue
<
string
>>>
(
resolve
=>
{
setTimeout
(()
=>
{
setIsLoading
(
false
);
resolve
(
options
.
filter
(
option
=>
option
.
label
&&
option
.
label
.
includes
(
inputValue
)));
},
1000
);
});
},
[
value
]
);
const
loadAsyncOptions
=
useCallback
(
inputValue
=>
{
return
new
Promise
<
Array
<
SelectableValue
<
string
>>>
(
resolve
=>
{
setTimeout
(()
=>
{
setIsLoading
(
false
);
resolve
(
options
.
filter
(
option
=>
option
.
label
&&
option
.
label
.
includes
(
inputValue
)));
},
1000
);
});
},
[]);
return
(
<
AsyncSelect
<
AsyncSelect
Component
value=
{
value
}
defaultOptions
width=
{
20
}
...
...
packages/grafana-ui/src/components/Forms/RadioButtonGroup/RadioButtonGroup.story.tsx
View file @
b00755a2
...
...
@@ -16,7 +16,7 @@ export default {
const
sizes
:
RadioButtonSize
[]
=
[
'sm'
,
'md'
];
export
const
s
imple
=
()
=>
{
export
const
S
imple
=
()
=>
{
const
[
selected
,
setSelected
]
=
useState
(
'graphite'
);
const
BEHAVIOUR_GROUP
=
'Behaviour props'
;
const
disabled
=
boolean
(
'Disabled'
,
false
,
BEHAVIOUR_GROUP
);
...
...
@@ -42,7 +42,7 @@ export const simple = () => {
);
};
export
const
f
ullWidth
=
()
=>
{
export
const
F
ullWidth
=
()
=>
{
const
[
selected
,
setSelected
]
=
useState
(
'elastic'
);
const
BEHAVIOUR_GROUP
=
'Behaviour props'
;
const
disabled
=
boolean
(
'Disabled'
,
false
,
BEHAVIOUR_GROUP
);
...
...
packages/grafana-ui/src/components/Icon/Icon.story.tsx
View file @
b00755a2
...
...
@@ -61,7 +61,7 @@ const IconWrapper: React.FC<{ name: IconName }> = ({ name }) => {
const
icons
=
getAvailableIcons
().
sort
((
a
,
b
)
=>
a
.
localeCompare
(
b
));
export
const
i
consOverview
=
()
=>
{
export
const
I
consOverview
=
()
=>
{
const
[
filter
,
setFilter
]
=
useState
(
''
);
const
searchIcon
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
...
...
packages/grafana-ui/src/components/IconButton/IconButton.story.tsx
View file @
b00755a2
...
...
@@ -15,7 +15,7 @@ export default {
},
};
export
const
s
imple
=
()
=>
{
export
const
S
imple
=
()
=>
{
const
theme
=
useTheme
();
return
(
...
...
packages/grafana-ui/src/components/Input/Input.story.tsx
View file @
b00755a2
...
...
@@ -17,7 +17,7 @@ export default {
},
};
export
const
s
imple
=
()
=>
{
export
const
S
imple
=
()
=>
{
const
prefixSuffixOpts
=
{
None
:
null
,
Text
:
'$'
,
...
...
@@ -96,7 +96,7 @@ export const simple = () => {
);
};
export
const
w
ithFieldValidation
=
()
=>
{
export
const
W
ithFieldValidation
=
()
=>
{
const
[
value
,
setValue
]
=
useState
(
''
);
return
(
...
...
packages/grafana-ui/src/components/Modal/Modal.story.tsx
View file @
b00755a2
...
...
@@ -58,7 +58,7 @@ const tabs = [
{
label
:
'3rd child'
,
value
:
'third'
,
active
:
false
},
];
export
const
w
ithTabs
=
()
=>
{
export
const
W
ithTabs
=
()
=>
{
const
[
activeTab
,
setActiveTab
]
=
useState
(
'first'
);
const
modalHeader
=
(
<
ModalTabsHeader
...
...
packages/grafana-ui/src/components/Select/Select.story.tsx
View file @
b00755a2
...
...
@@ -87,7 +87,7 @@ const getDynamicProps = () => {
};
};
export
const
b
asic
=
()
=>
{
export
const
B
asic
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
SelectableValue
<
string
>>
();
return
(
...
...
@@ -107,7 +107,7 @@ export const basic = () => {
/**
* Uses plain values instead of SelectableValue<T>
*/
export
const
b
asicSelectPlainValue
=
()
=>
{
export
const
B
asicSelectPlainValue
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
string
>
();
return
(
<>
...
...
@@ -158,7 +158,7 @@ export const SelectWithOptionDescriptions = () => {
/**
* Uses plain values instead of SelectableValue<T>
*/
export
const
m
ultiPlainValue
=
()
=>
{
export
const
M
ultiPlainValue
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
string
[]
>
();
return
(
...
...
@@ -175,7 +175,7 @@ export const multiPlainValue = () => {
);
};
export
const
multiSelect
=
()
=>
{
export
const
MultiSelectBasic
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
Array
<
SelectableValue
<
string
>>>
([]);
return
(
...
...
@@ -193,7 +193,7 @@ export const multiSelect = () => {
);
};
export
const
m
ultiSelectAsync
=
()
=>
{
export
const
M
ultiSelectAsync
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
Array
<
SelectableValue
<
string
>>>
();
return
(
...
...
@@ -209,7 +209,7 @@ export const multiSelectAsync = () => {
/>
);
};
export
const
buttonSelect
=
()
=>
{
export
const
ButtonSelectBasic
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
SelectableValue
<
string
>>
();
const
icon
=
getIconKnob
();
return
(
...
...
@@ -227,7 +227,7 @@ export const buttonSelect = () => {
);
};
export
const
b
asicSelectAsync
=
()
=>
{
export
const
B
asicSelectAsync
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
SelectableValue
<
string
>>
();
return
(
...
...
@@ -243,7 +243,7 @@ export const basicSelectAsync = () => {
);
};
export
const
c
ustomizedControl
=
()
=>
{
export
const
C
ustomizedControl
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
SelectableValue
<
string
>>
();
return
(
...
...
@@ -266,7 +266,7 @@ export const customizedControl = () => {
);
};
export
const
a
utoMenuPlacement
=
()
=>
{
export
const
A
utoMenuPlacement
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
SelectableValue
<
string
>>
();
return
(
...
...
@@ -285,7 +285,7 @@ export const autoMenuPlacement = () => {
);
};
export
const
c
ustomValueCreation
=
()
=>
{
export
const
C
ustomValueCreation
=
()
=>
{
const
[
value
,
setValue
]
=
useState
<
SelectableValue
<
string
>>
();
const
[
customOptions
,
setCustomOptions
]
=
useState
<
Array
<
SelectableValue
<
string
>>>
([]);
const
options
=
generateOptions
();
...
...
packages/grafana-ui/src/components/Switch/Switch.story.tsx
View file @
b00755a2
...
...
@@ -15,7 +15,7 @@ export default {
},
};
export
const
c
ontrolled
=
()
=>
{
export
const
C
ontrolled
=
()
=>
{
const
[
checked
,
setChecked
]
=
useState
(
false
);
const
onChange
=
useCallback
(
e
=>
setChecked
(
e
.
currentTarget
.
checked
),
[
setChecked
]);
const
BEHAVIOUR_GROUP
=
'Behaviour props'
;
...
...
@@ -23,7 +23,7 @@ export const controlled = () => {
return
<
Switch
value=
{
checked
}
disabled=
{
disabled
}
onChange=
{
onChange
}
/>;
};
export
const
u
ncontrolled
=
()
=>
{
export
const
U
ncontrolled
=
()
=>
{
const
BEHAVIOUR_GROUP
=
'Behaviour props'
;
const
disabled
=
boolean
(
'Disabled'
,
false
,
BEHAVIOUR_GROUP
);
return
<
Switch
disabled=
{
disabled
}
/>;
...
...
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