doc: create layout of the Card component

This commit is contained in:
Leon Xu committed 2023-01-30 17:39:34 -08:00
1 parent 8168ee7c0b
commit 11b16512c8
1 file changed
+35 -3
+35 -3
View File
@@ -1,7 +1,39 @@
import React from "react";
const Card = () => {
return <div>Card</div>;
};
import { download } from "../assets";
import { downloadImage } from "../utils";
const Card = ({ _id, name, prompt, photo }) => (
<div className="rounded-xl group relative shadow-card hover:shadow-cardhover card">
<img
className="w-full h-auto object-cover rounded-xl"
src={photo}
alt={prompt}
/>
<div className="group-hover:flex flex-col max-h-[94.5%] hidden absolute bottom-0 left-0 right-0 bg-[#10131f] m-2 p-4 rounded-md">
<p className="text-white text-sm overflow-y-auto prompt">{prompt}</p>
<div className="mt-5 flex justify-between items-center gap-2">
<div className="flex items-center gap-2">
<div className="w-7 h-7 rounded-full object-cover bg-green-700 flex justify-center items-center text-white text-xs font-bold">
{name[0]}
</div>
<p className="text-white text-sm">{name}</p>
</div>
<button
type="button"
onClick={() => downloadImage(_id, photo)}
className="outline-none bg-transparent border-none"
>
<img
src={download}
alt="download"
className="w-6 h-6 object-contain invert"
/>
</button>
</div>
</div>
</div>
);
export default Card;