Spaces:
Configuration error
Configuration error
Download frontend/src/components/features/settings/settings-input.tsx from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/components/features/settings/settings-input.tsx
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/components/features/settings/settings-input.tsx
-
curl -L -o settings-input.tsx https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/components/features/settings/settings-input.tsx
1.37 kB
| import { cn } from "#/utils/utils"; | |
| import { OptionalTag } from "./optional-tag"; | |
| interface SettingsInputProps { | |
| testId?: string; | |
| name?: string; | |
| label: string; | |
| type: React.HTMLInputTypeAttribute; | |
| defaultValue?: string; | |
| placeholder?: string; | |
| showOptionalTag?: boolean; | |
| isDisabled?: boolean; | |
| startContent?: React.ReactNode; | |
| className?: string; | |
| onChange?: (value: string) => void; | |
| } | |
| export function SettingsInput({ | |
| testId, | |
| name, | |
| label, | |
| type, | |
| defaultValue, | |
| placeholder, | |
| showOptionalTag, | |
| isDisabled, | |
| startContent, | |
| className, | |
| onChange, | |
| }: SettingsInputProps) { | |
| return ( | |
| <label className={cn("flex flex-col gap-2.5 w-fit", className)}> | |
| <div className="flex items-center gap-2"> | |
| {startContent} | |
| <span className="text-sm">{label}</span> | |
| {showOptionalTag && <OptionalTag />} | |
| </div> | |
| <input | |
| data-testid={testId} | |
| onChange={(e) => onChange?.(e.target.value)} | |
| name={name} | |
| disabled={isDisabled} | |
| type={type} | |
| defaultValue={defaultValue} | |
| placeholder={placeholder} | |
| className={cn( | |
| "bg-tertiary border border-[#717888] h-10 w-full rounded p-2 placeholder:italic placeholder:text-tertiary-alt", | |
| "disabled:bg-[#2D2F36] disabled:border-[#2D2F36] disabled:cursor-not-allowed", | |
| )} | |
| /> | |
| </label> | |
| ); | |
| } | |