@@ -100,8 +100,8 @@ export function Form({ defaultName, defaultEmail, onCancel, onSubmit, options }:
100100
101101 const $name = h ( 'input' , {
102102 id : 'name' ,
103- type : 'text' , // TODO can be hidden
104- ariaHidden : 'false' ,
103+ type : options . showName ? 'text' : ' hidden' ,
104+ ariaHidden : options . showName ? 'false' : 'true ',
105105 name : 'name' ,
106106 className : 'form__input' ,
107107 placeholder : options . namePlaceholder ,
@@ -110,8 +110,8 @@ export function Form({ defaultName, defaultEmail, onCancel, onSubmit, options }:
110110
111111 const $email = h ( 'input' , {
112112 id : 'email' ,
113- type : 'text' , // TODO can be hidden
114- ariaHidden : 'false' ,
113+ type : options . showEmail ? 'text' : ' hidden' ,
114+ ariaHidden : options . showEmail ? 'false' : 'true ',
115115 name : 'email' ,
116116 className : 'form__input' ,
117117 placeholder : options . emailPlaceholder ,
@@ -158,23 +158,30 @@ export function Form({ defaultName, defaultEmail, onCancel, onSubmit, options }:
158158 } ,
159159 [
160160 $error ,
161- h (
162- 'label' ,
163- {
164- htmlFor : 'name' ,
165- className : 'form__label' ,
166- } ,
167- [ options . nameLabel , $name ] ,
168- ) ,
169161
170- h (
171- 'label' ,
172- {
173- htmlFor : 'email' ,
174- className : 'form__label' ,
175- } ,
176- [ options . emailLabel , $email ] ,
177- ) ,
162+ ! options . isAnonymous &&
163+ options . showName &&
164+ h (
165+ 'label' ,
166+ {
167+ htmlFor : 'name' ,
168+ className : 'form__label' ,
169+ } ,
170+ [ options . nameLabel , $name ] ,
171+ ) ,
172+ ! options . isAnonymous && ! options . showName && $name ,
173+
174+ ! options . isAnonymous &&
175+ options . showEmail &&
176+ h (
177+ 'label' ,
178+ {
179+ htmlFor : 'email' ,
180+ className : 'form__label' ,
181+ } ,
182+ [ options . emailLabel , $email ] ,
183+ ) ,
184+ ! options . isAnonymous && ! options . showEmail && $email ,
178185
179186 h (
180187 'label' ,
0 commit comments