/* * 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", the "GNU Affero General Public License v3.0 only", and the "Server Side * Public License v 1"; you may not use this file except in compliance with, at * your election, the "Elastic License 2.0", the "GNU Affero General Public * License v3.0 only", or the "Server Side Public License, v 1". */ import React, { useState } from 'react'; import { EuiButton, EuiButtonGroup, EuiFormRow, EuiPopover, EuiRange } from '@elastic/eui'; import { GridSettings } from '@kbn/grid-layout'; import { i18n } from '@kbn/i18n'; import { ViewMode } from '@kbn/presentation-publishing'; import { MockDashboardApi } from './types'; export const GridLayoutOptions = ({ viewMode, mockDashboardApi, gridSettings, setGridSettings, }: { viewMode: ViewMode; mockDashboardApi: MockDashboardApi; gridSettings: GridSettings; setGridSettings: (settings: GridSettings) => void; }) => { const [isSettingsPopoverOpen, setIsSettingsPopoverOpen] = useState(false); return ( setIsSettingsPopoverOpen(!isSettingsPopoverOpen)} > {i18n.translate('examples.gridExample.settingsPopover.title', { defaultMessage: 'Layout settings', })} } isOpen={isSettingsPopoverOpen} closePopover={() => setIsSettingsPopoverOpen(false)} > <> { mockDashboardApi.setViewMode(id as ViewMode); }} /> setGridSettings({ ...gridSettings, gutterSize: parseInt(e.currentTarget.value, 10) }) } showLabels showValue /> setGridSettings({ ...gridSettings, rowHeight: parseInt(e.currentTarget.value, 10) }) } showLabels showValue /> ); };