Esteves Enzo commited on
Commit
25c0ab6
·
1 Parent(s): 900465b

onSubmit event

Browse files
Files changed (1) hide show
  1. components/input-generation.tsx +5 -0
components/input-generation.tsx CHANGED
@@ -31,6 +31,11 @@ export const InputGeneration: React.FC<Props> = ({
31
  className="h-full text-lg placeholder:text-gray-400 text-gray-900 font-medium w-full outline-none truncate"
32
  placeholder="A thug cat riding his small bike"
33
  onChange={(e) => onChange(e.target.value)}
 
 
 
 
 
34
  />
35
  </div>
36
  <button
 
31
  className="h-full text-lg placeholder:text-gray-400 text-gray-900 font-medium w-full outline-none truncate"
32
  placeholder="A thug cat riding his small bike"
33
  onChange={(e) => onChange(e.target.value)}
34
+ onKeyDown={(e) => {
35
+ if (e.key === "Enter" && prompt && !loading) {
36
+ onSubmit();
37
+ }
38
+ }}
39
  />
40
  </div>
41
  <button