Skip to content

Commit

Permalink
fix(textarea): allow multi-row textarea (#16)
Browse files Browse the repository at this point in the history
* feat(component): allow multi-row textarea

when rows are provided to a textarea, the fixed height is removed and set to "auto"

* fix: fix storybook and adjust scss

* Update docs/components/text-field.md

Co-Authored-By: i8ramin <[email protected]>

* Update packages/core/src/components/text-field/_text-field.scss

Co-Authored-By: i8ramin <[email protected]>
  • Loading branch information
i8ramin authored and adamraider committed Apr 27, 2019
1 parent 1b6a799 commit 9cfbdbd
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
7 changes: 7 additions & 0 deletions docs/components/text-field.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ title: Text Field
>
</component>

<component
name="Text area with rows"
component="text-area"
variation="text-area-multi-row"
>
</component>

<component
name="Text field with hints"
component="text-field"
Expand Down
12 changes: 12 additions & 0 deletions docs/html/text-area/text-area-multi-row.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div class="ray-text-area">
<textarea
rows="4"
class="ray-text-area__input"
id="notes"
type="email"
placeholder="adding `rows` overrides default height"
></textarea>
<label class="ray-text-area__label" for="notes">
Long notes
</label>
</div>
7 changes: 7 additions & 0 deletions packages/core/src/components/text-field/_text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,11 @@
}
}
}

[rows].#{$ray-class-prefix}text-area {
&__input {
height: auto; // ie11 fallback
height: unset;
}
}
}
2 changes: 1 addition & 1 deletion packages/core/stories/text-field.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ storiesOf('Text Field', module)
<div className="ray-text-area">
<textarea
className="ray-text-area__input"
row="4"
rows="4"
id="textarea"
placeholder="Few people are aware..."
/>
Expand Down

0 comments on commit 9cfbdbd

Please sign in to comment.