Skip to content

Commit ea017a1

Browse files
feat: add textarea component and placeholders for dynamic parameters component (#17466)
- Hooks up the textarea component - Adds placeholders for dropdown, input and multi-select combobox --------- Co-authored-by: brettkolodny <brettkolodny@gmail.com>
1 parent 41b2165 commit ea017a1

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

site/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
} from "components/Select/Select";
2525
import { Slider } from "components/Slider/Slider";
2626
import { Switch } from "components/Switch/Switch";
27+
import { Textarea } from "components/Textarea/Textarea";
2728
import {
2829
Tooltip,
2930
TooltipContent,
@@ -175,7 +176,12 @@ const ParameterField: FC<ParameterFieldProps> = ({
175176
disabled={disabled}
176177
>
177178
<SelectTrigger>
178-
<SelectValue placeholder="Select option" />
179+
<SelectValue
180+
placeholder={
181+
(parameter.styling as { placeholder?: string })?.placeholder ||
182+
"Select option"
183+
}
184+
/>
179185
</SelectTrigger>
180186
<SelectContent>
181187
{parameter.options.map((option) => (
@@ -218,7 +224,10 @@ const ParameterField: FC<ParameterFieldProps> = ({
218224
onChange(JSON.stringify(values));
219225
}}
220226
hidePlaceholderWhenSelected
221-
placeholder="Select option"
227+
placeholder={
228+
(parameter.styling as { placeholder?: string })?.placeholder ||
229+
"Select option"
230+
}
222231
emptyIndicator={
223232
<p className="text-center text-md text-content-primary">
224233
No results found
@@ -301,6 +310,18 @@ const ParameterField: FC<ParameterFieldProps> = ({
301310
/>
302311
);
303312

313+
case "textarea":
314+
return (
315+
<Textarea
316+
defaultValue={defaultValue}
317+
onChange={(e) => onChange(e.target.value)}
318+
disabled={disabled}
319+
placeholder={
320+
(parameter.styling as { placeholder?: string })?.placeholder
321+
}
322+
/>
323+
);
324+
304325
case "input": {
305326
const inputType = parameter.type === "number" ? "number" : "text";
306327
const inputProps: Record<string, unknown> = {};
@@ -325,7 +346,7 @@ const ParameterField: FC<ParameterFieldProps> = ({
325346
onChange={(e) => onChange(e.target.value)}
326347
disabled={disabled}
327348
placeholder={
328-
(parameter.styling as { placehholder?: string })?.placehholder
349+
(parameter.styling as { placeholder?: string })?.placeholder
329350
}
330351
{...inputProps}
331352
/>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy