mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: updates clear all button to responsive button (#19719)
* Explore: updates clear all button to responsive button * Explore: update toolbar icons alignment * Explore: adds responsive styles for explore icon alignment
This commit is contained in:
@@ -251,7 +251,7 @@ export class UnConnectedExploreToolbar extends PureComponent<Props, {}> {
|
||||
)}
|
||||
|
||||
{exploreId === 'left' && !splitted ? (
|
||||
<div className="explore-toolbar-content-item">
|
||||
<div className="explore-toolbar-content-item explore-icon-align">
|
||||
<ResponsiveButton
|
||||
splitted={splitted}
|
||||
title="Split"
|
||||
@@ -275,10 +275,14 @@ export class UnConnectedExploreToolbar extends PureComponent<Props, {}> {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="explore-toolbar-content-item">
|
||||
<button className="btn navbar-button" onClick={this.onClearAll}>
|
||||
Clear All
|
||||
</button>
|
||||
<div className="explore-toolbar-content-item explore-icon-align">
|
||||
<ResponsiveButton
|
||||
splitted={splitted}
|
||||
title="Clear All"
|
||||
onClick={this.onClearAll}
|
||||
iconClassName="fa fa-fw fa-trash icon-margin-right"
|
||||
disabled={isLive}
|
||||
/>
|
||||
</div>
|
||||
<div className="explore-toolbar-content-item">
|
||||
<RunButton
|
||||
|
||||
@@ -15,6 +15,10 @@ type Props = {
|
||||
disabled?: boolean;
|
||||
};
|
||||
|
||||
function formatBtnTitle(title: string, iconSide?: string): string {
|
||||
return iconSide === IconSide.left ? '\xA0' + title : iconSide === IconSide.right ? title + '\xA0' : title;
|
||||
}
|
||||
|
||||
export const ResponsiveButton = (props: Props) => {
|
||||
const defaultProps = {
|
||||
iconSide: IconSide.left,
|
||||
@@ -28,19 +32,9 @@ export const ResponsiveButton = (props: Props) => {
|
||||
onClick={onClick}
|
||||
disabled={disabled || false}
|
||||
>
|
||||
{iconClassName && iconSide === IconSide.left ? (
|
||||
<>
|
||||
<i className={`${iconClassName}`} />
|
||||
|
||||
</>
|
||||
) : null}
|
||||
<span className="btn-title">{!splitted ? title : ''}</span>
|
||||
{iconClassName && iconSide === IconSide.right ? (
|
||||
<>
|
||||
|
||||
<i className={`${iconClassName}`} />
|
||||
</>
|
||||
) : null}
|
||||
{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>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user