diff --git a/web/src/components/ui/select/Select.tsx b/web/src/components/ui/select/Select.tsx index 3d421bb50..18a85447e 100644 --- a/web/src/components/ui/select/Select.tsx +++ b/web/src/components/ui/select/Select.tsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Select as SelectBase, SelectContent, @@ -24,7 +24,7 @@ export interface SelectItem { disabled?: boolean; } -export interface SelectProps { +export interface SelectProps { items: SelectItem[] | SelectItemGroup[]; disabled?: boolean; onChange: (value: T) => void; @@ -36,7 +36,7 @@ export interface SelectProps { className?: string; } -const _Select = ({ +const _Select = ({ items, showIndex, disabled, @@ -68,7 +68,7 @@ const _Select = ({ ); }; _Select.displayName = 'Select'; -export const Select = React.memo(_Select) as typeof _Select; +export const Select = _Select; const SelectItemSelector = ({ item, @@ -113,3 +113,26 @@ SelectItemSelector.displayName = 'SelectItemSelector'; const SelectItemSecondaryText: React.FC<{ children: React.ReactNode }> = ({ children }) => { return {children}; }; + +const ExampleUsage = () => { + const [value, setValue] = useState(''); + const values: SelectItem<'1' | '2'>[] = [ + { + value: '1', + label: '1' + }, + { + value: '2', + label: '2' + } + ]; + + return ( + @@ -87,9 +88,7 @@ const StylingPopover: React.FC<{ rowCount: number; }> = ({ metricColumnId, columnLabelFormat, rowCount }) => { return ( - } - placement="leftBottom"> -