Skip to content

Commit

Permalink
feat(text-field): add isCondensed prop (#2787)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Creasman <[email protected]>
  • Loading branch information
jmcreasman and Jonathan Creasman authored Apr 22, 2024
1 parent 96fe379 commit d30700f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-walls-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-uikit/text-field': minor
---

Included a new property (**isCondensed**) which allows to render a more visually compact variant of the input.
1 change: 1 addition & 0 deletions packages/components/fields/text-field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default Example;
| `onBlur` | `FocusEventHandler` | | | Called when input is blurred |
| `onFocus` | `FocusEventHandler` | | | Called when input is focused |
| `isAutofocussed` | `boolean` | | | Focus the input on initial render |
| `isCondensed` | `boolean` | | | Use this property to reduce the paddings of the component for a ui compact variant |
| `isDisabled` | `boolean` | | | Indicates that the input cannot be modified (e.g not authorized, or changes currently saving). |
| `isReadOnly` | `boolean` | | | Indicates that the field is displaying read-only content |
| `placeholder` | `string` | | | Placeholder text for the input |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ storiesOf('Components|Fields', module)
onBlur={action('onBlur')}
onFocus={action('onFocus')}
isAutofocussed={boolean('isAutofocussed', false)}
isCondensed={boolean('isCondensed', false)}
isDisabled={boolean('isDisabled', false)}
isReadOnly={boolean('isReadOnly', false)}
placeholder={text('placeholder', 'Placeholder')}
Expand Down
5 changes: 5 additions & 0 deletions packages/components/fields/text-field/src/text-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ export type TTextFieldProps = {
* Focus the input on initial render
*/
isAutofocussed?: boolean;
/**
* Use this property to reduce the paddings of the component for a ui compact variant
*/
isCondensed?: boolean;
/**
* Indicates that the input cannot be modified (e.g not authorized, or changes currently saving).
*/
Expand Down Expand Up @@ -237,6 +241,7 @@ class TextField extends Component<TTextFieldProps, TTextFieldState> {
onBlur={this.props.onBlur}
onFocus={this.props.onFocus}
isAutofocussed={this.props.isAutofocussed}
isCondensed={this.props.isCondensed}
isDisabled={this.props.isDisabled}
isReadOnly={this.props.isReadOnly}
hasWarning={hasWarning}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,14 @@ export const component = () => (
renderWarning={() => 'Custom warning'}
/>
</Spec>
<Spec label="with isCondensed">
<TextField
title="Welcome Text"
value={value}
isCondensed={true}
onChange={() => {}}
horizontalConstraint={7}
/>
</Spec>
</Suite>
);

0 comments on commit d30700f

Please sign in to comment.