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
2e326d1c
Unverified
Commit
2e326d1c
authored
May 01, 2019
by
Ryan McKinley
Committed by
GitHub
May 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FormLabel: allow any rather than just a string for tooltip (#16841)
parent
9d01b216
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
packages/grafana-ui/src/components/FormField/FormField.tsx
+13
-2
packages/grafana-ui/src/components/FormLabel/FormLabel.tsx
+2
-1
No files found.
packages/grafana-ui/src/components/FormField/FormField.tsx
View file @
2e326d1c
import
React
,
{
InputHTMLAttributes
,
FunctionComponent
}
from
'react'
;
import
{
FormLabel
}
from
'../FormLabel/FormLabel'
;
import
{
PopperContent
}
from
'../Tooltip/PopperController'
;
export
interface
Props
extends
InputHTMLAttributes
<
HTMLInputElement
>
{
label
:
string
;
tooltip
?:
PopperContent
<
any
>
;
labelWidth
?:
number
;
inputWidth
?:
number
;
inputEl
?:
React
.
ReactNode
;
...
...
@@ -17,10 +19,19 @@ const defaultProps = {
* Default form field including label used in Grafana UI. Default input element is simple <input />. You can also pass
* custom inputEl if required in which case inputWidth and inputProps are ignored.
*/
export
const
FormField
:
FunctionComponent
<
Props
>
=
({
label
,
labelWidth
,
inputWidth
,
inputEl
,
...
inputProps
})
=>
{
export
const
FormField
:
FunctionComponent
<
Props
>
=
({
label
,
tooltip
,
labelWidth
,
inputWidth
,
inputEl
,
...
inputProps
})
=>
{
return
(
<
div
className=
"form-field"
>
<
FormLabel
width=
{
labelWidth
}
>
{
label
}
</
FormLabel
>
<
FormLabel
width=
{
labelWidth
}
tooltip=
{
tooltip
}
>
{
label
}
</
FormLabel
>
{
inputEl
||
<
input
type=
"text"
className=
{
`gf-form-input width-${inputWidth}`
}
{
...
inputProps
}
/>
}
</
div
>
);
...
...
packages/grafana-ui/src/components/FormLabel/FormLabel.tsx
View file @
2e326d1c
import
React
,
{
FunctionComponent
,
ReactNode
}
from
'react'
;
import
classNames
from
'classnames'
;
import
{
Tooltip
}
from
'../Tooltip/Tooltip'
;
import
{
PopperContent
}
from
'../Tooltip/PopperController'
;
interface
Props
{
children
:
ReactNode
;
...
...
@@ -8,7 +9,7 @@ interface Props {
htmlFor
?:
string
;
isFocused
?:
boolean
;
isInvalid
?:
boolean
;
tooltip
?:
string
;
tooltip
?:
PopperContent
<
any
>
;
width
?:
number
;
}
...
...
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