Skip to content

Commit

Permalink
Merge pull request #126 from abusix/fix-color-of-optional-formfield-l…
Browse files Browse the repository at this point in the history
…abel
  • Loading branch information
Coderwelsch authored Jun 7, 2024
2 parents d10f296 + ae82a7c commit d92a022
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/form-field/form-field-label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export interface FormFieldLabelProps {

export const FormFieldLabel = ({ htmlFor, children, optional }: FormFieldLabelProps) => {
return (
<div className="flex items-baseline gap-1">
<label htmlFor={htmlFor} className="headline-400 text-neutral-800">
<div className="flex items-baseline gap-1 text-neutral-800">
<label htmlFor={htmlFor} className="headline-400">
{children}
</label>

Expand Down
17 changes: 16 additions & 1 deletion src/components/form-field/text-input/text-input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,27 @@ const TextInputWithHooks = ({
hasLeftIcon = false,
readOnly = false,
value,
optional,
}: {
error?: boolean;
disabled?: boolean;
hasLeftIcon?: boolean;
readOnly?: boolean;
value?: string;
optional?: boolean;
}) => {
const [inputValue, setInputValue] = useState(value);

return (
<FormField>
<FormField.LabelGroup>
<FormField.Label htmlFor="value">Label</FormField.Label>
<FormField.Label htmlFor="value" optional={optional}>
Label
</FormField.Label>

<FormField.Description id="value-description">Description</FormField.Description>
</FormField.LabelGroup>

<FormField.TextInput
id="value"
value={inputValue}
Expand All @@ -44,6 +50,7 @@ const TextInputWithHooks = ({
LeftIcon={hasLeftIcon ? SearchIcon : undefined}
readOnly={readOnly}
/>

{error ? <FormField.ErrorMessage>Error message.</FormField.ErrorMessage> : null}
</FormField>
);
Expand Down Expand Up @@ -88,3 +95,11 @@ export const Disabled: Story = {
</div>
),
};

export const Optional: Story = {
render: () => (
<div className="w-72">
<TextInputWithHooks optional />
</div>
),
};

0 comments on commit d92a022

Please sign in to comment.