File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+ import { text , boolean , number } from "@storybook/addon-knobs" ;
3+ import { TextArea } from "./text-area" ;
4+ import Faker from "faker" ;
5+
6+ export default {
7+ component : TextArea ,
8+ title : "Atoms | Forms / Text Area" ,
9+ } ;
10+
11+ export const textAreaKnobs = ( ) => (
12+ < TextArea
13+ disabled = { boolean ( "Disabled" , false ) }
14+ id = { Faker . random . uuid ( ) }
15+ maxLength = { number ( "Max Length" , 30 ) }
16+ onChange = { ( ) => { } }
17+ placeholder = { text ( "Placeholder" , "Placeholder..." ) }
18+ rows = { number ( "Rows" , 5 ) }
19+ value = { text ( "Value" , "Input Value" ) }
20+ />
21+ ) ;
Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+
3+ describe ( "TextArea" , ( ) => {
4+ test . skip ( "TODO - https://github.com/AndcultureCode/AndcultureCode.JavaScript.React.Components/issues/10" , ( ) => { } ) ;
5+ } ) ;
Original file line number Diff line number Diff line change 1+ import React from "react" ;
2+
3+ // -----------------------------------------------------------------------------------------
4+ // #region Interfaces
5+ // -----------------------------------------------------------------------------------------
6+
7+ export interface TextAreaProps {
8+ disabled ?: boolean ;
9+ id : string ;
10+ maxLength ?: number ;
11+ name ?: string ;
12+ onChange : ( e : React . ChangeEvent < HTMLTextAreaElement > ) => void ;
13+ placeholder ?: string ;
14+ rows ?: number ;
15+
16+ /**
17+ * Unique identifier used select the underlying <textarea> for functional/e2e testing
18+ */
19+ testId ?: string ;
20+ value ?: string ;
21+ }
22+
23+ // #endregion Interfaces
24+
25+ // -----------------------------------------------------------------------------------------
26+ // #region Component
27+ // -----------------------------------------------------------------------------------------
28+
29+ const TextArea : React . FC < TextAreaProps > = ( props : TextAreaProps ) => {
30+ const {
31+ disabled,
32+ id,
33+ maxLength,
34+ name,
35+ onChange,
36+ placeholder,
37+ rows,
38+ testId,
39+ value,
40+ } = props ;
41+
42+ return (
43+ < textarea
44+ data-test-id = { testId }
45+ disabled = { disabled }
46+ id = { id }
47+ maxLength = { maxLength }
48+ name = { name }
49+ onChange = { onChange }
50+ placeholder = { placeholder }
51+ rows = { rows }
52+ value = { value }
53+ />
54+ ) ;
55+ } ;
56+
57+ // #endregion Component
58+
59+ // -----------------------------------------------------------------------------------------
60+ // #region Exports
61+ // -----------------------------------------------------------------------------------------
62+
63+ export { TextArea } ;
64+
65+ // #endregion Exports
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ export { CheckboxButton } from "./atoms/forms/checkbox-button";
1111export { CheckboxInput } from "./atoms/forms/checkbox-input" ;
1212export { PasswordInput } from "./atoms/forms/password-input" ;
1313export { SubmitButton } from "./atoms/forms/submit-button" ;
14+ export { TextArea } from "./atoms/forms/text-area" ;
1415export { TextInput } from "./atoms/forms/text-input" ;
1516export { TextInputIcon } from "./atoms/forms/text-input-icon" ;
1617
You can’t perform that action at this time.
0 commit comments