From a2f80ad94f4919279aaab3b763229be8888e5789 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CSalar?= <“salar.sali97@gmail.com”> Date: Tue, 30 Aug 2022 13:50:20 +0300 Subject: [PATCH] Featured Authors section --- src/components/FeaturedAuthors.tsx | 169 +++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 src/components/FeaturedAuthors.tsx diff --git a/src/components/FeaturedAuthors.tsx b/src/components/FeaturedAuthors.tsx new file mode 100644 index 0000000..a3efad3 --- /dev/null +++ b/src/components/FeaturedAuthors.tsx @@ -0,0 +1,169 @@ +/* -------------------------------------------------------------------------- */ +/* Components */ +/* -------------------------------------------------------------------------- */ +import Heading from "./typography/Heading"; +import SkeletonCard from "./SkeletonCard"; +import { Button } from "./Button/Button"; +import Avatar from "./Avatar"; +import Card from "./Card"; +import Link from "./Link"; + +/* -------------------------------------------------------------------------- */ +/* Swiper */ +/* -------------------------------------------------------------------------- */ +import { Swiper, SwiperSlide } from "swiper/react"; +import SwiperCore, { Navigation } from "swiper"; +import "swiper/css/pagination"; +import "swiper/css/navigation"; +import "./styles.css"; +import "swiper/css"; + +/* -------------------------------------------------------------------------- */ +/* Authors */ +/* -------------------------------------------------------------------------- */ +import Authors from "./Authors.json"; + +/* -------------------------------------------------------------------------- */ +/* Icons */ +/* -------------------------------------------------------------------------- */ +import { ReactComponent as SVGCaretRight } from "assets/svg/caret-right.svg"; + +/* -------------------------------------------------------------------------- */ +/* Variables */ +/* -------------------------------------------------------------------------- */ +SwiperCore.use([Navigation]); + +/* -------------------------------------------------------------------------- */ +/* Number of Cards */ +/* -------------------------------------------------------------------------- */ +let twoCards: boolean = false; +let threeCards: boolean = false; +console.log(`Number of cards ${Authors.length}`); +if (Authors.length == 2) { + twoCards = true; +} else if (Authors.length == 3) { + threeCards = true; +} + +/** + * Featured authors component to display ... + */ +export default function FeaturedAuthors(): JSX.Element { + return ( +
+ {/* The Title of Featured Authors section */} + Featured Authors + + {/* Featured Authors section */} +
+ 4 ? true : false} + loopFillGroupWithBlank={false} + breakpoints={{ + 768: { + slidesPerView: 2, + slidesPerGroup: 2, + }, + 1024: { + slidesPerView: 2, + slidesPerGroup: 2, + }, + 1280: { + slidesPerView: 4, + slidesPerGroup: 4, + }, + 1580: { + slidesPerView: 4, + slidesPerGroup: 4, + }, + }} + > + {Authors.map((card) => ( + + + + + + {card.img ? ( + + ) : ( + + {card.Title[0]} + + )} + + {card.Title} + + {card.Body} + + + + See More + + + + + ))} + + {twoCards && [ + + + + + + + + + + + + , + + + + + + + + + + + + + , + ]} + + {threeCards && [ + + + + + + + + + + + + , + ]} + +
+ + +
+ ); +}