Skip to content

Commit

Permalink
cosmetic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rysloan4 committed Mar 22, 2023
1 parent 605ad82 commit 1982ab3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 12 deletions.
43 changes: 31 additions & 12 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useState } from "react";
import styles from "./index.module.css";

export default function Home() {
const [animalInput, setAnimalInput] = useState("");
const [placeInput, setPlaceInput] = useState("");
const [preferencesInput, setPreferencesInput] = useState("");
const [result, setResult] = useState();

async function onSubmit(event) {
Expand All @@ -14,7 +15,10 @@ export default function Home() {
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ animal: animalInput }),
body: JSON.stringify({
place: placeInput,
preferences: preferencesInput
}),
});

const data = await response.json();
Expand All @@ -23,7 +27,8 @@ export default function Home() {
}

setResult(data.result);
setAnimalInput("");
setPlaceInput("");
setPreferencesInput("");
} catch(error) {
// Consider implementing your own error handling logic here
console.error(error);
Expand All @@ -34,22 +39,36 @@ export default function Home() {
return (
<div>
<Head>
<title>OpenAI Quickstart</title>
<link rel="icon" href="/dog.png" />
<link rel="icon" href="/palm.png" />
</Head>

<main className={styles.main}>
<img src="/dog.png" className={styles.icon} />
<h3>Name my pet</h3>
<img src="/palm.png" className={styles.icon} />
<h3></h3>
<form onSubmit={onSubmit}>
<label
for="place"
>Where are you going?</label>
<input
type="text"
name="animal"
placeholder="Enter an animal"
value={animalInput}
onChange={(e) => setAnimalInput(e.target.value)}
id="place"
name="place"
placeholder="Enter a place"
value={placeInput}
onChange={(e) => setPlaceInput(e.target.value)}
/>
<input type="submit" value="Generate names" />
<label
for="place"
>What are you into?</label>
<input
type="text"
id="place"
name="place"
placeholder="Enter a place"
value={placeInput}
onChange={(e) => setPlaceInput(e.target.value)}
/>
<input type="submit" value="Plan my trip" />
</form>
<div className={styles.result}>{result}</div>
</main>
Expand Down
5 changes: 5 additions & 0 deletions pages/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
color: #8e8ea0;
opacity: 1;
}
.main label {
font-size: 20px;
line-height: 35px;
color: #202123;
}
.main input[type="submit"] {
padding: 12px 0;
color: #fff;
Expand Down
Binary file added public/palm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 1982ab3

@vercel
Copy link

@vercel vercel bot commented on 1982ab3 Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

ai-example – ./

ai-example-rysloan4.vercel.app
ai-example-git-main-rysloan4.vercel.app
ai-example-sooty.vercel.app

Please sign in to comment.