diff --git a/src/components/HeroSection/HeroElements.jsx b/src/components/HeroSection/HeroElements.jsx index eeabca0..cf48e2f 100755 --- a/src/components/HeroSection/HeroElements.jsx +++ b/src/components/HeroSection/HeroElements.jsx @@ -274,3 +274,21 @@ export const HeroFollowBlock = styled.div` font-size: 14px; } `; + +export const HeroNewsMoreButton = styled.button` + background: #fff; + color: #000; + font-size: 16px; + padding: 10px 24px; + border: none; + border-radius: 4px; + cursor: pointer; + margin-top: 20px; + margin-bottom: 20px; + align-self: center; + + &:hover { + background: #000; + color: #fff; + } +`; diff --git a/src/components/HeroSection/index.jsx b/src/components/HeroSection/index.jsx index 1bdba5b..cdb7dfa 100755 --- a/src/components/HeroSection/index.jsx +++ b/src/components/HeroSection/index.jsx @@ -13,12 +13,14 @@ import { HeroNewsItem, HeroNewsItemContent, HeroNewsItemDate, + HeroNewsMoreButton, HeroNewsTitle, HeroRow, Img, UDLLink, } from "@/components/HeroSection/HeroElements"; import img from "@/images/book_cover.jpg"; +import { useState } from "react"; const citation = ` @book{prince2023understanding, @@ -140,6 +142,12 @@ const news = [ ]; export default function HeroSection() { + const [showMoreNews, setShowMoreNews] = useState(false); + + const toggleShowMore = () => { + setShowMoreNews((p) => !p); + }; + return ( @@ -147,12 +155,15 @@ export default function HeroSection() { RECENT NEWS: - {news.map((item, index) => ( + {(showMoreNews ? news : news.slice(0, 7)).map((item, index) => ( {item.date} {item.content} ))} + + {showMoreNews ? "Show less" : "Show more"} + CITATION: