Skip to content

Commit

Permalink
Merge pull request #92 from smallcloudai/fix/select-scroll-behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
alashchev17 authored Sep 6, 2024
2 parents 77feb4c + d579706 commit d083473
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/ChatForm/PromptSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ export type PromptSelectProps = {
onChange: (value: SystemPrompts) => void;
prompts: SystemPrompts;
disabled?: boolean;
contentPosition?: "item-aligned" | "popper";
};

export const PromptSelect: React.FC<PromptSelectProps> = ({
value,
prompts,
onChange,
disabled,
contentPosition,
}) => {
// TODO: just use the hooks here
const promptKeysAndValues = Object.entries(prompts);
Expand All @@ -41,7 +43,7 @@ export const PromptSelect: React.FC<PromptSelectProps> = ({
size="1"
>
<Trigger title={val} />
<Content>
<Content position={contentPosition ? contentPosition : "popper"}>
{Object.entries(prompts).map(([key, value]) => {
return (
<Item
Expand Down
4 changes: 3 additions & 1 deletion src/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type SelectProps = React.ComponentProps<typeof RadixSelect.Root> & {
onChange: (value: string) => void;
options: string[];
title?: string;
contentPosition?: "item-aligned" | "popper";
};

export type SelectRootProps = React.ComponentProps<typeof RadixSelect.Root>;
Expand Down Expand Up @@ -40,12 +41,13 @@ export const Select: React.FC<SelectProps> = ({
title,
options,
onChange,
contentPosition,
...props
}) => {
return (
<Root {...props} onValueChange={onChange} size="1">
<Trigger title={title} />
<Content>
<Content position={contentPosition ? contentPosition : "popper"}>
{options.map((option) => {
return (
<Item key={option} value={option}>
Expand Down
1 change: 1 addition & 0 deletions src/components/Select/select.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
/* JB doesn't support dvw yet */
max-width: 50vw;
max-width: 80dvw;
max-height: 200px;
}

0 comments on commit d083473

Please sign in to comment.