Skip to content

Commit

Permalink
tweaks again
Browse files Browse the repository at this point in the history
  • Loading branch information
mimarz committed Sep 20, 2023
1 parent c1669bf commit 171d36a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 25 deletions.
5 changes: 5 additions & 0 deletions packages/react/src/components/form/Textfield/Textfield.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ import * as TextfieldStories from './Textfield.stories';
<Primary />
<Controls />

## Antall tegn

<Canvas of={TextfieldStories.WithCharacterCounter} />

## Kontrollert

<Canvas of={TextfieldStories.Controlled} />
34 changes: 17 additions & 17 deletions packages/react/src/components/form/Textfield/Textfield.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@
display: inline-block;
}

.label {
min-width: min-content;
display: inline-flex;
flex-direction: row;
gap: var(--fds-spacing-1);
align-items: center;
}

.description {
color: var(--fds-semantic-text-neutral-subtle);
}

.input {
font: inherit;
position: relative;
Expand All @@ -26,18 +38,6 @@
border-radius: var(--fds-border_radius-medium);
}

.label {
min-width: min-content;
display: inline-flex;
flex-direction: row;
gap: var(--fds-spacing-1);
align-items: center;
}

.description {
color: var(--fds-semantic-text-neutral-subtle);
}

.disabled {
opacity: 0.3;
}
Expand All @@ -63,16 +63,16 @@
}
}

.inputSufix {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

.inputPrefix {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}

.inputSufix {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

.prefix {
border-right: 0;
border-top-right-radius: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const Preview: Story = {
label: 'Label',
disabled: false,
readOnly: false,
size: 'medium',
description: '',
},
};
Expand All @@ -25,12 +26,7 @@ export const WithCharacterCounter: Story = {
args: {
label: 'Label',
characterLimit: {
label: (count) =>
count > -1
? `${count} character Left`
: `${Math.abs(count)} characters to many.`,
maxCount: 5,
srLabel: `Field with room for ${5} characters.`,
},
},
};
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/form/Textfield/Textfield.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ export const Textfield = forwardRef<HTMLInputElement, TextfieldProps>(
>
{label && (
<Label
size={size}
weight='medium'
htmlFor={inputProps.id}
className={cn(
classes.label,
hideLabel && utilityClasses.visuallyHidden,
)}
htmlFor={inputProps.id}
size={size}
weight='medium'
>
{readOnly && (
<PadlockLockedFillIcon
Expand Down

0 comments on commit 171d36a

Please sign in to comment.