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
013179ee
Commit
013179ee
authored
Oct 17, 2019
by
Łukasz Siatka
Committed by
Lukas Siatka
Nov 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: fixes explore responsive button ref
parent
1cc1e545
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
14 deletions
+26
-14
public/app/features/explore/ResponsiveButton.tsx
+26
-14
No files found.
public/app/features/explore/ResponsiveButton.tsx
View file @
013179ee
...
...
@@ -5,7 +5,7 @@ export enum IconSide {
right
=
'right'
,
}
type
Props
=
{
interface
Props
extends
React
.
HTMLAttributes
<
HTMLDivElement
>
{
splitted
:
boolean
;
title
:
string
;
onClick
:
()
=>
void
;
...
...
@@ -13,29 +13,41 @@ type Props = {
iconClassName
?:
string
;
iconSide
?:
IconSide
;
disabled
?:
boolean
;
}
;
}
function
formatBtnTitle
(
title
:
string
,
iconSide
?:
string
):
string
{
return
iconSide
===
IconSide
.
left
?
'
\
xA0'
+
title
:
iconSide
===
IconSide
.
right
?
title
+
'
\
xA0'
:
title
;
}
export
const
ResponsiveButton
=
forwardRef
<
HTML
Button
Element
,
Props
>
((
props
,
ref
)
=>
{
export
const
ResponsiveButton
=
forwardRef
<
HTML
Div
Element
,
Props
>
((
props
,
ref
)
=>
{
const
defaultProps
=
{
iconSide
:
IconSide
.
left
,
};
props
=
{
...
defaultProps
,
...
props
};
const
{
title
,
onClick
,
buttonClassName
,
iconClassName
,
splitted
,
iconSide
,
disabled
}
=
props
;
const
{
title
,
onClick
,
buttonClassName
,
iconClassName
,
splitted
,
iconSide
,
disabled
,
onMouseEnter
,
onMouseLeave
,
}
=
props
;
return
(
<
button
className=
{
`btn navbar-button ${buttonClassName ? buttonClassName : ''}`
}
onClick=
{
onClick
}
disabled=
{
disabled
||
false
}
ref=
{
ref
}
>
{
iconClassName
&&
iconSide
===
IconSide
.
left
?
<
i
className=
{
`${iconClassName}`
}
/>
:
null
}
<
span
className=
"btn-title"
>
{
!
splitted
?
formatBtnTitle
(
title
,
iconSide
)
:
''
}
</
span
>
{
iconClassName
&&
iconSide
===
IconSide
.
right
?
<
i
className=
{
`${iconClassName}`
}
/>
:
null
}
</
button
>
<
div
ref=
{
ref
}
onMouseEnter=
{
onMouseEnter
}
onMouseLeave=
{
onMouseLeave
}
>
<
button
className=
{
`btn navbar-button ${buttonClassName ? buttonClassName : ''}`
}
onClick=
{
onClick
}
disabled=
{
disabled
||
false
}
>
{
iconClassName
&&
iconSide
===
IconSide
.
left
?
<
i
className=
{
`${iconClassName}`
}
/>
:
null
}
<
span
className=
"btn-title"
>
{
!
splitted
?
formatBtnTitle
(
title
,
iconSide
)
:
''
}
</
span
>
{
iconClassName
&&
iconSide
===
IconSide
.
right
?
<
i
className=
{
`${iconClassName}`
}
/>
:
null
}
</
button
>
</
div
>
);
});
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