mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
PanelEdit: Title tweaks (#22237)
This commit is contained in:
parent
5396c9ef92
commit
bfa959c66a
@ -279,11 +279,7 @@ export class PanelEditorUnconnected extends PureComponent<Props> {
|
|||||||
>
|
>
|
||||||
{this.renderHorizontalSplit(styles)}
|
{this.renderHorizontalSplit(styles)}
|
||||||
<div className={styles.panelOptionsPane}>
|
<div className={styles.panelOptionsPane}>
|
||||||
<CustomScrollbar
|
<CustomScrollbar>
|
||||||
className={css`
|
|
||||||
height: 100% !important;
|
|
||||||
`}
|
|
||||||
>
|
|
||||||
{this.renderFieldOptions()}
|
{this.renderFieldOptions()}
|
||||||
<OptionsGroup title="Old settings">{this.renderVisSettings()}</OptionsGroup>
|
<OptionsGroup title="Old settings">{this.renderVisSettings()}</OptionsGroup>
|
||||||
</CustomScrollbar>
|
</CustomScrollbar>
|
||||||
@ -403,6 +399,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme) => {
|
|||||||
position: relative;
|
position: relative;
|
||||||
`,
|
`,
|
||||||
toolbarLeft: css`
|
toolbarLeft: css`
|
||||||
|
padding-left: ${theme.spacing.sm};
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
`,
|
`,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { css } from 'emotion';
|
import { css } from 'emotion';
|
||||||
import { Forms, useTheme } from '@grafana/ui';
|
import { Forms, useTheme, stylesFactory } from '@grafana/ui';
|
||||||
|
import { GrafanaTheme } from '@grafana/data';
|
||||||
|
|
||||||
interface PanelTitleProps {
|
interface PanelTitleProps {
|
||||||
value: string;
|
value: string;
|
||||||
@ -10,26 +11,30 @@ interface PanelTitleProps {
|
|||||||
export const PanelTitle: React.FC<PanelTitleProps> = ({ value, onChange }) => {
|
export const PanelTitle: React.FC<PanelTitleProps> = ({ value, onChange }) => {
|
||||||
const [isEditing, setIsEditing] = useState(false);
|
const [isEditing, setIsEditing] = useState(false);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const styles = getStyles(theme);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className={styles.wrapper}>
|
||||||
{isEditing ? (
|
{isEditing ? (
|
||||||
<Forms.Input
|
<Forms.Input
|
||||||
value={value || ''}
|
value={value || ''}
|
||||||
|
ref={elem => elem && elem.focus()}
|
||||||
onChange={e => onChange(e.currentTarget.value)}
|
onChange={e => onChange(e.currentTarget.value)}
|
||||||
onBlur={() => setIsEditing(false)}
|
onBlur={() => setIsEditing(false)}
|
||||||
placeholder="Panel Title"
|
placeholder="Panel Title"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<span
|
<span onClick={() => setIsEditing(true)}>{value}</span>
|
||||||
className={css`
|
|
||||||
font-size: ${theme.typography.size.lg};
|
|
||||||
margin-left: ${theme.spacing.sm};
|
|
||||||
`}
|
|
||||||
onClick={() => setIsEditing(true)}
|
|
||||||
>
|
|
||||||
{value}
|
|
||||||
</span>
|
|
||||||
)}
|
)}
|
||||||
</>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getStyles = stylesFactory((theme: GrafanaTheme) => {
|
||||||
|
return {
|
||||||
|
wrapper: css`
|
||||||
|
font-size: ${theme.typography.size.lg};
|
||||||
|
padding-left: ${theme.spacing.md};
|
||||||
|
`,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user