-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lens] Add metric Viz config options, title position and sizing (#124124
) * Add lens config options * wip * Pr feedback * simplify align * improve typing * update typing * PR feedback * Design PR feedback * snapshot * update snap * design suggestions * Use bottom as default position for title and some other small refactoring * Fix test * Fix shapshot * Fix shapshot Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Uladzislau Lasitsa <[email protected]>
- Loading branch information
1 parent
cf25ac3
commit b7b5088
Showing
15 changed files
with
493 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
x-pack/plugins/lens/public/metric_visualization/metric_config_panel/align_options.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiButtonGroup } from '@elastic/eui'; | ||
import { MetricState } from '../../../common/expressions'; | ||
|
||
export interface TitlePositionProps { | ||
state: MetricState; | ||
setState: (newState: MetricState) => void; | ||
} | ||
|
||
const alignButtonIcons = [ | ||
{ | ||
id: `left`, | ||
label: i18n.translate('xpack.lens.metricChart.alignLabel.left', { | ||
defaultMessage: 'Align left', | ||
}), | ||
iconType: 'editorAlignLeft', | ||
}, | ||
{ | ||
id: `center`, | ||
label: i18n.translate('xpack.lens.metricChart.alignLabel.center', { | ||
defaultMessage: 'Align center', | ||
}), | ||
iconType: 'editorAlignCenter', | ||
}, | ||
{ | ||
id: `right`, | ||
label: i18n.translate('xpack.lens.metricChart.alignLabel.right', { | ||
defaultMessage: 'Align right', | ||
}), | ||
iconType: 'editorAlignRight', | ||
}, | ||
]; | ||
|
||
export const AlignOptions: React.FC<TitlePositionProps> = ({ state, setState }) => { | ||
return ( | ||
<EuiButtonGroup | ||
legend={i18n.translate('xpack.lens.metricChart.titleAlignLabel', { | ||
defaultMessage: 'Align', | ||
})} | ||
options={alignButtonIcons} | ||
idSelected={state.textAlign ?? 'center'} | ||
onChange={(id) => { | ||
setState({ ...state, textAlign: id as MetricState['textAlign'] }); | ||
}} | ||
isIconOnly | ||
buttonSize="compressed" | ||
/> | ||
); | ||
}; |
Oops, something went wrong.