import React, { useMemo } from 'react'; import { SelectableValue } from '@grafana/data'; import { Select } from '@grafana/ui'; import { periodOption } from '../constants'; export interface Props { inputId: string; onChange: (period: string) => void; templateVariableOptions: Array>; aligmentPeriods: periodOption[]; selectWidth?: number; category?: string; disabled?: boolean; current?: string; } export function PeriodSelect({ inputId, templateVariableOptions, onChange, current, selectWidth, disabled, aligmentPeriods, }: Props) { const options = useMemo( () => aligmentPeriods.map((ap) => ({ ...ap, label: ap.text, })), [aligmentPeriods] ); const visibleOptions = useMemo(() => options.filter((ap) => !ap.hidden), [options]); return ( ); }