doc: added UI/UX for the input field

This commit is contained in:
Leon Xu committed 2023-01-30 15:07:02 -08:00
1 parent ff7891c5ab
commit 852d5a8104
1 file changed
+47 -1
+47 -1
View File
@@ -14,7 +14,7 @@ const CreatePost = () => {
photo: "",
});
const [generatingImg, setGeneratingImg] = useState(false);
const [generatingImg, setGeneratingImg] = useState();
const [loading, setLoading] = useState(false);
const handleSubmit = () => {};
@@ -23,6 +23,8 @@ const CreatePost = () => {
const handleSurpriseMe = () => {};
const generateImage = () => {};
return (
<section className="max-w-7xl mx-auto">
<div>
@@ -54,6 +56,50 @@ const CreatePost = () => {
isSurpriseMe
handleSurpriseMe={handleSurpriseMe}
/>
<div className="relative bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 w-64 p-3 h-64 flex justify-center items-center">
{form.photo ? (
<img
src={form.photo}
alt={form.prompt}
className="w-full h-full object-contain"
/>
) : (
<img
src={preview}
alt="preview"
className="w-9/12 h-9/12 object-contain opacity-40"
/>
)}
{generatingImg && (
<div className="absolute inset-0 z-0 flex justify-center items-center bg-[rgba(0,0,0,0.5)] rounded-lg">
<Loader />
</div>
)}
</div>
</div>
<div className="mt-5 flex gap-5 ">
<button
type="button"
onClick={generateImage}
className="text-white bg-green-700 font-medium rounded-md text-sm w-full sm:w-auto px-5 py-2.5 text-center"
>
{generatingImg ? "Generating..." : "Generate Image"}
</button>
</div>
<div className="mt-10">
<p className="mt-2 text-[#666E75] text-[14px]">
Once you have created the image you want, you can share it with
others in the community
</p>
<button
type="submit"
className="mt-3 text-white bg-[#6469ff] font-medium rounded-md text-sm w-full sm:w-auto px-5 py-2.5 text-center"
>
{loading ? "Sharing..." : "Share with the community"}
</button>
</div>
</form>
</section>