From 2f7289fe857da6c769cea2152e9e9b7c6502d089 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Mon, 3 Mar 2025 23:20:46 -0700 Subject: [PATCH] updated popovers --- web/src/components/ui/select/Select.tsx | 31 ++++++++++++++++--- .../StylingMetric/EditMetricField.tsx | 22 ++++++------- .../StylingMetric/helpers.tsx | 4 +-- .../ReasoningMessage_ThoughtPills.tsx | 10 +++--- 4 files changed, 44 insertions(+), 23 deletions(-) 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"> -