Skip to content
This repository was archived by the owner on Apr 19, 2021. It is now read-only.

Commit e0ef58d

Browse files
committed
WIP
1 parent 15fe7db commit e0ef58d

File tree

1 file changed

+68
-10
lines changed
  • src/components/extension-uninstall

1 file changed

+68
-10
lines changed

src/components/extension-uninstall/Form.tsx

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,14 @@ const StyledForm = styled.form`
4848

4949
const Form = () => {
5050
const [state, setState] = useState<{
51+
name?: string
52+
consent?: boolean
53+
email?: string
5154
feedback: string
5255
otherFeedback?: string
5356
messageSent?: boolean
57+
errorMessage?: string
58+
5459
}>({
5560
feedback: ''
5661
})
@@ -78,9 +83,12 @@ const Form = () => {
7883
e.preventDefault()
7984

8085
const email: Email = {
81-
subject: 'Why did I uninstall the browser extension?',
82-
feedback: state.feedback,
83-
otherFeedback: state.otherFeedback
86+
from: {
87+
email: state.email,
88+
name: state.name
89+
},
90+
subject: 'Why did I uninstall the browser extension?' + ' (from ' + state.email + ')',
91+
message: state.feedback + state.otherFeedback
8492
}
8593

8694
fetch('/.netlify/functions/submit-form', {
@@ -103,8 +111,20 @@ const Form = () => {
103111
onSubmit={handleSubmit}
104112
>
105113
{
106-
!state.messageSent ? (
114+
state.messageSent ? (
115+
<div className="sucess">
116+
<img src={tick} className="tick" alt="Tick" />
117+
<h3>Thanks for your Feedback</h3>
118+
</div>
119+
) : (
107120
<>
121+
122+
<div style={{ visibility: 'hidden' }}>
123+
<label>
124+
Don’t fill this out if you're human: <input name="bot-field" />
125+
</label>
126+
</div>
127+
108128
<input type="hidden" name="form-name" value="extension-deletion" />
109129
<h3>Why did you uninstall the browser extension?</h3>
110130
<p>Check all that apply:</p>
@@ -125,15 +145,53 @@ const Form = () => {
125145
<input type="checkbox" onChange={handleChange} name="expected" data-text="Gitpod isn’t what I expected" />
126146
Gitpod isn’t what I expected
127147
</label>
148+
128149
<textarea onChange={handleTextAreaChange} aria-label="Do you have any other feedback?" placeholder="Do you have any other feedback?" name="otherFeedback"></textarea>
150+
151+
<label className="visually-hidden" htmlFor="Name">
152+
{' '}
153+
Name
154+
</label>
155+
<input
156+
autoFocus
157+
name="name"
158+
className="form__input form__input--half"
159+
type="text"
160+
placeholder="Name"
161+
id="Name"
162+
onChange={handleChange}
163+
/>
164+
<label className="visually-hidden" htmlFor="email">
165+
E-Mail
166+
</label>
167+
<input
168+
name="email"
169+
className="form__input form__input--half"
170+
type="email"
171+
placeholder="E-mail"
172+
id="email"
173+
onChange={handleChange}
174+
/>
175+
176+
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', margin: '0px 0px 20px 0px' }}>
177+
178+
<input
179+
name="consent"
180+
id="consent"
181+
type="checkbox"
182+
onChange={handleChange}
183+
style={{ margin: '0px 10px', transform: 'translateY(.5rem)' }}
184+
/>
185+
<label htmlFor="consent">
186+
I consent to having this website store my submitted information so that a support staff can respond to my inquiry.
187+
</label>
188+
</div>
189+
190+
{state.errorMessage ? <p className="error">{state.errorMessage}</p> : null}
191+
129192
<button className="btn" disabled={!state.feedback && !state.otherFeedback}>Send</button>
130193
</div>
131-
</>) : (
132-
<div className="sucess">
133-
<img src={tick} className="tick" alt="Tick" />
134-
<h3>Thanks for your Feedback</h3>
135-
</div>
136-
)
194+
</>)
137195
}
138196
</StyledForm>
139197
)

0 commit comments

Comments
 (0)