Chore/TimezonesEditor: Add vertical gaps between inputs (#94487)

This commit is contained in:
kay delaney 2024-10-10 01:57:14 +01:00 committed by GitHub
parent 97de44b0c2
commit 0201e8e8fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 25 deletions

View File

@ -6712,10 +6712,6 @@ exports[`better eslint`] = {
"public/app/plugins/panel/timeseries/SpanNullsEditor.tsx:5381": [
[0, 0, 0, "\'HorizontalGroup\' import from \'@grafana/ui\' is restricted from being used by a pattern. Use Stack component instead.", "0"]
],
"public/app/plugins/panel/timeseries/TimezonesEditor.tsx:5381": [
[0, 0, 0, "Styles should be written using objects.", "0"],
[0, 0, 0, "Styles should be written using objects.", "1"]
],
"public/app/plugins/panel/timeseries/migrations.ts:5381": [
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
[0, 0, 0, "Do not use any type assertions.", "1"],

View File

@ -34,36 +34,34 @@ export const TimezonesEditor = ({ value, onChange }: Props) => {
};
return (
<div>
<ul className={styles.list}>
{value.map((tz, idx) => (
<div className={styles.wrapper} key={`${idx}.${tz}`}>
<span className={styles.first}>
<TimeZonePicker
onChange={(v) => setTimezone(idx, v)}
includeInternal={true}
value={tz ?? InternalTimeZones.default}
/>
</span>
<li className={styles.listItem} key={`${idx}.${tz}`}>
<TimeZonePicker
onChange={(v) => setTimezone(idx, v)}
includeInternal={true}
value={tz ?? InternalTimeZones.default}
/>
{idx === value.length - 1 ? (
<IconButton name="plus" onClick={addTimezone} tooltip="Add timezone" />
) : (
<IconButton name="times" onClick={() => removeTimezone(idx)} tooltip="Remove timezone" />
)}
</div>
</li>
))}
</div>
</ul>
);
};
const getStyles = (theme: GrafanaTheme2) => ({
wrapper: css`
width: 100%;
display: flex;
flex-direction: rows;
align-items: center;
`,
first: css`
margin-right: 8px;
flex-grow: 2;
`,
list: css({
listStyle: 'none',
display: 'flex',
flexDirection: 'column',
gap: theme.spacing(0.5),
}),
listItem: css({
display: 'flex',
gap: theme.spacing(1),
}),
});