Skip to content

Commit fb02081

Browse files
Mariela TihovaMariela Tihova
authored andcommitted
Resolving comments and formatting code
1 parent a169072 commit fb02081

1 file changed

Lines changed: 46 additions & 30 deletions

File tree

  • samples/inputs/textarea/form-integration/src
Lines changed: 46 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,56 @@
1-
import React from 'react';
2-
import ReactDOM from 'react-dom/client';
3-
import './index.css';
4-
import { IgrTextarea, IgrButton, IgrToast } from 'igniteui-react';
5-
import 'igniteui-webcomponents/themes/light/bootstrap.css';
1+
import React from "react";
2+
import ReactDOM from "react-dom/client";
3+
import "./index.css";
4+
import { IgrTextarea, IgrButton, IgrToast } from "igniteui-react";
5+
import "igniteui-webcomponents/themes/light/bootstrap.css";
66

77
export default function TextAreaFormIntegration() {
8+
let toastRef: IgrToast;
89

9-
let toastRef: IgrToast;
10-
11-
const onToastRef = (toast: IgrToast) => {
12-
if (!toast) { return; }
13-
toastRef = toast;
10+
const onToastRef = (toast: IgrToast) => {
11+
if (!toast) {
12+
return;
1413
}
14+
toastRef = toast;
15+
};
1516

16-
const onSubmitButtonClicked = (e:React.FormEvent<HTMLFormElement>) => {
17-
if(toastRef){
18-
e.preventDefault();
19-
toastRef.show();
20-
}
17+
const onSubmitButtonClicked = (e: React.FormEvent<HTMLFormElement>) => {
18+
if (toastRef) {
19+
e.preventDefault();
20+
toastRef.show();
2121
}
22+
};
2223

23-
return (
24-
<div className="sample">
25-
<form id="form" onSubmit={onSubmitButtonClicked}>
26-
<IgrTextarea rows={3} name="user_feedback" label="Your review" required>
27-
</IgrTextarea>
28-
<div className="controls">
29-
<IgrButton type="submit"><span>Submit review</span></IgrButton>
30-
<IgrButton type="reset" variant="outlined"><span>Reset</span></IgrButton>
31-
</div>
32-
<IgrToast id="submitted" position="top" display-time="1e3" ref={onToastRef}><span>Your review was submitted</span></IgrToast>
33-
</form>
34-
</div>
35-
);
24+
return (
25+
<div className="sample">
26+
<form id="form" onSubmit={onSubmitButtonClicked}>
27+
<IgrTextarea
28+
rows={3}
29+
name="user_feedback"
30+
label="Your review"
31+
required
32+
></IgrTextarea>
33+
<div className="controls">
34+
<IgrButton type="submit">
35+
<span>Submit review</span>
36+
</IgrButton>
37+
<IgrButton type="reset" variant="outlined">
38+
<span>Reset</span>
39+
</IgrButton>
40+
</div>
41+
<IgrToast
42+
id="submitted"
43+
position="top"
44+
displayTime={1000}
45+
ref={onToastRef}
46+
>
47+
<span>Your review was submitted</span>
48+
</IgrToast>
49+
</form>
50+
</div>
51+
);
3652
}
3753

3854
// rendering above class to the React DOM
39-
const root = ReactDOM.createRoot(document.getElementById('root'));
40-
root.render(<TextAreaFormIntegration/>);
55+
const root = ReactDOM.createRoot(document.getElementById("root"));
56+
root.render(<TextAreaFormIntegration />);

0 commit comments

Comments
 (0)