From 6edea738fa357c48402cf7042b57eb6b88e51b87 Mon Sep 17 00:00:00 2001 From: Emil Gulamov <125820963+mearashadowfax@users.noreply.github.com> Date: Tue, 27 Feb 2024 06:15:35 +0400 Subject: [PATCH] Add ReviewComponent and refactor HeroSection The HeroSection component code has been refactored to include a whole new block component called ReviewComponent, which contains code for presenting avatars, review ratings, and the number of reviews previously contained within HeroSection alone. This enhances code modularity. Now, HeroSection simply imports and utilizes ReviewComponent when needed, making the code more concise and easier to manage. --- .../sections/landing/HeroSection.astro | 54 ++-------------- .../ui/blocks/ReviewComponent.astro | 61 +++++++++++++++++++ 2 files changed, 66 insertions(+), 49 deletions(-) create mode 100644 src/components/ui/blocks/ReviewComponent.astro diff --git a/src/components/sections/landing/HeroSection.astro b/src/components/sections/landing/HeroSection.astro index b5b1978..61b4e25 100644 --- a/src/components/sections/landing/HeroSection.astro +++ b/src/components/sections/landing/HeroSection.astro @@ -4,9 +4,7 @@ import { Image } from "astro:assets"; import heroImage from "../../../images/hero-image.avif"; import PrimaryCTA from "../../ui/buttons/PrimaryCTA.astro"; import SecondaryCTA from "../../ui/buttons/SecondaryCTA.astro"; -import Avatar from "../../ui/avatars/Avatar.astro"; -import FullStar from "../../ui/stars/FullStar.astro"; -import HalfStar from "../../ui/stars/HalfStar.astro"; +import ReviewComponent from "../../ui/blocks/ReviewComponent.astro"; // Define props from Astro const { @@ -18,7 +16,7 @@ const { secondaryBtnURL, withReview, avatars, - starCount = 0, + starCount, rating, reviews } = Astro.props; @@ -71,52 +69,10 @@ interface Props { { withReview ? ( -
-
-
+
+