mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 01:53: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)}
|
||||
<div className={styles.panelOptionsPane}>
|
||||
<CustomScrollbar
|
||||
className={css`
|
||||
height: 100% !important;
|
||||
`}
|
||||
>
|
||||
<CustomScrollbar>
|
||||
{this.renderFieldOptions()}
|
||||
<OptionsGroup title="Old settings">{this.renderVisSettings()}</OptionsGroup>
|
||||
</CustomScrollbar>
|
||||
@ -403,6 +399,7 @@ const getStyles = stylesFactory((theme: GrafanaTheme) => {
|
||||
position: relative;
|
||||
`,
|
||||
toolbarLeft: css`
|
||||
padding-left: ${theme.spacing.sm};
|
||||
display: flex;
|
||||
align-items: center;
|
||||
`,
|
||||
|
@ -1,6 +1,7 @@
|
||||
import React, { useState } from 'react';
|
||||
import { css } from 'emotion';
|
||||
import { Forms, useTheme } from '@grafana/ui';
|
||||
import { Forms, useTheme, stylesFactory } from '@grafana/ui';
|
||||
import { GrafanaTheme } from '@grafana/data';
|
||||
|
||||
interface PanelTitleProps {
|
||||
value: string;
|
||||
@ -10,26 +11,30 @@ interface PanelTitleProps {
|
||||
export const PanelTitle: React.FC<PanelTitleProps> = ({ value, onChange }) => {
|
||||
const [isEditing, setIsEditing] = useState(false);
|
||||
const theme = useTheme();
|
||||
const styles = getStyles(theme);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={styles.wrapper}>
|
||||
{isEditing ? (
|
||||
<Forms.Input
|
||||
value={value || ''}
|
||||
ref={elem => elem && elem.focus()}
|
||||
onChange={e => onChange(e.currentTarget.value)}
|
||||
onBlur={() => setIsEditing(false)}
|
||||
placeholder="Panel Title"
|
||||
/>
|
||||
) : (
|
||||
<span
|
||||
className={css`
|
||||
font-size: ${theme.typography.size.lg};
|
||||
margin-left: ${theme.spacing.sm};
|
||||
`}
|
||||
onClick={() => setIsEditing(true)}
|
||||
>
|
||||
{value}
|
||||
</span>
|
||||
<span 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