|
@@ -1,172 +1,97 @@
|
|
|
-import { Avatar, AvatarFallback, AvatarImage } from "./ui/avatar";
|
|
|
-import { Badge } from "./ui/badge";
|
|
|
-import { Button, buttonVariants } from "@/components/ui/button";
|
|
|
import {
|
|
|
Card,
|
|
|
CardContent,
|
|
|
CardDescription,
|
|
|
CardHeader,
|
|
|
CardTitle,
|
|
|
- CardFooter,
|
|
|
} from "@/components/ui/card";
|
|
|
-import { Check, Linkedin } from "lucide-react";
|
|
|
import { LightBulbIcon } from "./Icons";
|
|
|
-import { GitHubLogoIcon } from "@radix-ui/react-icons";
|
|
|
+import Logo from "../assets/logo.png";
|
|
|
+import {useEffect, useState} from "react";
|
|
|
+import {extractSubstring} from "@/services/api.ts";
|
|
|
+import axios from "axios";
|
|
|
|
|
|
export const HeroCards = () => {
|
|
|
+ const [product1, setProduct1] = useState(null);
|
|
|
+ const [description1, setDescription1] = useState(null);
|
|
|
+ const [product2, setProduct2] = useState(null);
|
|
|
+ const [description2, setDescription2] = useState(null);
|
|
|
+ useEffect(() => {
|
|
|
+ // 使用 axios 进行 API 调用
|
|
|
+ const fetchData = async () => {
|
|
|
+ try {
|
|
|
+ const websiteCode = extractSubstring(window.location.pathname);
|
|
|
+ const response = await axios.get('/api/website/template/getWebsiteByWebsiteCode', {
|
|
|
+ params: {
|
|
|
+ websiteCode: websiteCode
|
|
|
+ }
|
|
|
+ });
|
|
|
+ const userWebsiteId = response.data.data.id;
|
|
|
+ const response2 = await axios.get('/api/website/template/products', {
|
|
|
+ params: {
|
|
|
+ userWebsiteId: userWebsiteId
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (response2.data.data.length > 0) {
|
|
|
+ setProduct1(response2.data.data[0].name);
|
|
|
+ setDescription1(response2.data.data[0].description);
|
|
|
+ setProduct2(response2.data.data[1].name);
|
|
|
+ setDescription2(response2.data.data[1].description);
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ console.error('Error fetching data:', err);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ fetchData();
|
|
|
+
|
|
|
+ }, []);
|
|
|
return (
|
|
|
<div className="hidden lg:flex flex-row flex-wrap gap-8 relative w-[700px] h-[500px]">
|
|
|
{/* Testimonial */}
|
|
|
<Card className="absolute w-[340px] -top-[15px] drop-shadow-xl shadow-black/10 dark:shadow-white/10">
|
|
|
- <CardHeader className="flex flex-row items-center gap-4 pb-2">
|
|
|
- <Avatar>
|
|
|
- <AvatarImage
|
|
|
- alt=""
|
|
|
- src="https://github.com/shadcn.png"
|
|
|
- />
|
|
|
- <AvatarFallback>SH</AvatarFallback>
|
|
|
- </Avatar>
|
|
|
-
|
|
|
- <div className="flex flex-col">
|
|
|
- <CardTitle className="text-lg">John Doe React</CardTitle>
|
|
|
- <CardDescription>@john_doe</CardDescription>
|
|
|
+ <CardHeader className="space-y-1 flex md:flex-row justify-start items-start gap-4">
|
|
|
+ <div className="mt-1 bg-primary/20 p-1 rounded-2xl">
|
|
|
+ <LightBulbIcon />
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <CardTitle>Light & dark mode</CardTitle>
|
|
|
+ <CardDescription className="text-md mt-2">
|
|
|
+ Lorem ipsum dolor sit amet consect adipisicing elit. Consectetur
|
|
|
+ natusm.
|
|
|
+ </CardDescription>
|
|
|
</div>
|
|
|
</CardHeader>
|
|
|
-
|
|
|
- <CardContent>This landing page is awesome!</CardContent>
|
|
|
</Card>
|
|
|
|
|
|
{/* Team */}
|
|
|
<Card className="absolute right-[20px] top-4 w-80 flex flex-col justify-center items-center drop-shadow-xl shadow-black/10 dark:shadow-white/10">
|
|
|
<CardHeader className="mt-8 flex justify-center items-center pb-2">
|
|
|
<img
|
|
|
- src="https://i.pravatar.cc/150?img=58"
|
|
|
+ src={Logo}
|
|
|
alt="user avatar"
|
|
|
className="absolute grayscale-[0%] -top-12 rounded-full w-24 h-24 aspect-square object-cover"
|
|
|
/>
|
|
|
- <CardTitle className="text-center">Leo Miranda</CardTitle>
|
|
|
- <CardDescription className="font-normal text-primary">
|
|
|
- Frontend Developer
|
|
|
- </CardDescription>
|
|
|
+ <CardTitle className="text-center">{product1}</CardTitle>
|
|
|
</CardHeader>
|
|
|
|
|
|
<CardContent className="text-center pb-2">
|
|
|
<p>
|
|
|
- I really enjoy transforming ideas into functional software that
|
|
|
- exceeds expectations
|
|
|
+ {description1}
|
|
|
</p>
|
|
|
</CardContent>
|
|
|
-
|
|
|
- <CardFooter>
|
|
|
- <div>
|
|
|
- <a
|
|
|
- rel="noreferrer noopener"
|
|
|
- href="https://github.com/leoMirandaa"
|
|
|
- target="_blank"
|
|
|
- className={buttonVariants({
|
|
|
- variant: "ghost",
|
|
|
- size: "sm",
|
|
|
- })}
|
|
|
- >
|
|
|
- <span className="sr-only">Github icon</span>
|
|
|
- <GitHubLogoIcon className="w-5 h-5" />
|
|
|
- </a>
|
|
|
- <a
|
|
|
- rel="noreferrer noopener"
|
|
|
- href="https://twitter.com/leo_mirand4"
|
|
|
- target="_blank"
|
|
|
- className={buttonVariants({
|
|
|
- variant: "ghost",
|
|
|
- size: "sm",
|
|
|
- })}
|
|
|
- >
|
|
|
- <span className="sr-only">X icon</span>
|
|
|
- <svg
|
|
|
- role="img"
|
|
|
- viewBox="0 0 24 24"
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
- className="fill-foreground w-5 h-5"
|
|
|
- >
|
|
|
- <title>X</title>
|
|
|
- <path d="M18.901 1.153h3.68l-8.04 9.19L24 22.846h-7.406l-5.8-7.584-6.638 7.584H.474l8.6-9.83L0 1.154h7.594l5.243 6.932ZM17.61 20.644h2.039L6.486 3.24H4.298Z" />
|
|
|
- </svg>
|
|
|
- </a>
|
|
|
-
|
|
|
- <a
|
|
|
- rel="noreferrer noopener"
|
|
|
- href="https://www.linkedin.com/in/leopoldo-miranda/"
|
|
|
- target="_blank"
|
|
|
- className={buttonVariants({
|
|
|
- variant: "ghost",
|
|
|
- size: "sm",
|
|
|
- })}
|
|
|
- >
|
|
|
- <span className="sr-only">Linkedin icon</span>
|
|
|
- <Linkedin size="20" />
|
|
|
- </a>
|
|
|
- </div>
|
|
|
- </CardFooter>
|
|
|
</Card>
|
|
|
|
|
|
{/* Pricing */}
|
|
|
- <Card className="absolute top-[150px] left-[50px] w-72 drop-shadow-xl shadow-black/10 dark:shadow-white/10">
|
|
|
+ <Card className="absolute top-[200px] left-[50px] w-72 drop-shadow-xl shadow-black/10 dark:shadow-white/10">
|
|
|
<CardHeader>
|
|
|
<CardTitle className="flex item-center justify-between">
|
|
|
- Free
|
|
|
- <Badge
|
|
|
- variant="secondary"
|
|
|
- className="text-sm text-primary"
|
|
|
- >
|
|
|
- Most popular
|
|
|
- </Badge>
|
|
|
+ {product2}
|
|
|
</CardTitle>
|
|
|
- <div>
|
|
|
- <span className="text-3xl font-bold">$0</span>
|
|
|
- <span className="text-muted-foreground"> /month</span>
|
|
|
- </div>
|
|
|
-
|
|
|
<CardDescription>
|
|
|
- Lorem ipsum dolor sit, amet ipsum consectetur adipisicing elit.
|
|
|
+ {description2}
|
|
|
</CardDescription>
|
|
|
</CardHeader>
|
|
|
-
|
|
|
- <CardContent>
|
|
|
- <Button className="w-full">Start Free Trial</Button>
|
|
|
- </CardContent>
|
|
|
-
|
|
|
- <hr className="w-4/5 m-auto mb-4" />
|
|
|
-
|
|
|
- <CardFooter className="flex">
|
|
|
- <div className="space-y-4">
|
|
|
- {["4 Team member", "4 GB Storage", "Upto 6 pages"].map(
|
|
|
- (benefit: string) => (
|
|
|
- <span
|
|
|
- key={benefit}
|
|
|
- className="flex"
|
|
|
- >
|
|
|
- <Check className="text-green-500" />{" "}
|
|
|
- <h3 className="ml-2">{benefit}</h3>
|
|
|
- </span>
|
|
|
- )
|
|
|
- )}
|
|
|
- </div>
|
|
|
- </CardFooter>
|
|
|
- </Card>
|
|
|
-
|
|
|
- {/* Service */}
|
|
|
- <Card className="absolute w-[350px] -right-[10px] bottom-[35px] drop-shadow-xl shadow-black/10 dark:shadow-white/10">
|
|
|
- <CardHeader className="space-y-1 flex md:flex-row justify-start items-start gap-4">
|
|
|
- <div className="mt-1 bg-primary/20 p-1 rounded-2xl">
|
|
|
- <LightBulbIcon />
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <CardTitle>Light & dark mode</CardTitle>
|
|
|
- <CardDescription className="text-md mt-2">
|
|
|
- Lorem ipsum dolor sit amet consect adipisicing elit. Consectetur
|
|
|
- natusm.
|
|
|
- </CardDescription>
|
|
|
- </div>
|
|
|
- </CardHeader>
|
|
|
</Card>
|
|
|
</div>
|
|
|
);
|