diff --git a/app/[locale]/about-us/components/collaboratingPartner.tsx b/app/[locale]/about-us/components/collaboratingPartner.tsx index a0dd3df..60b19e2 100644 --- a/app/[locale]/about-us/components/collaboratingPartner.tsx +++ b/app/[locale]/about-us/components/collaboratingPartner.tsx @@ -1,11 +1,10 @@ -import { useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import Image from 'next/image'; import { Button, Icon, Text } from 'opub-ui'; import { CollaboratingPartnerHPText, CollaboratingPartnerTextOne, - CollaboratingPartnerTextTwo, } from '@/config/consts'; import { handleRedirect } from '@/lib/utils'; import Icons from '@/components/icons'; @@ -13,6 +12,23 @@ import { MediaRendering } from '@/components/media-rendering'; export function CollaboratingPartner() { const [showMore, setShowMore] = useState(false); + const [isDescriptionLong, setIsDescriptionLong] = useState(false); + + const descriptionRef = useRef(null); + const toggleShowMore = (event: React.MouseEvent) => { + event.preventDefault(); // Prevent link navigation + event.stopPropagation(); // Stop event from propagating to the card's link + setShowMore((prevState) => !prevState); + }; + + useEffect(() => { + if (descriptionRef.current) { + const isLong = + descriptionRef.current.scrollHeight > + descriptionRef.current.clientHeight; + setIsDescriptionLong(isLong); + } + }, []); return (
- - {CollaboratingPartnerTextOne} - - - {CollaboratingPartnerTextTwo} - +
+
+ + {/* {CollaboratingPartnerTextOne} */} + {CollaboratingPartnerTextOne} + +
+ + {/* Only show the "Show more" button on medium and small screens */} + {isDescriptionLong && ( +
+ +
+ )} +
@@ -132,9 +168,31 @@ export function CollaboratingPartner() {
- - {CollaboratingPartnerHPText} - +
+
+ + {CollaboratingPartnerHPText} + +
+ + {/* Only show the "Show more" button on medium and small screens */} + {isDescriptionLong && ( +
+ +
+ )} +
diff --git a/app/[locale]/about-us/components/supportedBy.tsx b/app/[locale]/about-us/components/supportedBy.tsx index 27cbad4..10a1944 100644 --- a/app/[locale]/about-us/components/supportedBy.tsx +++ b/app/[locale]/about-us/components/supportedBy.tsx @@ -1,10 +1,8 @@ -import { useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import Image from 'next/image'; import { Button, Icon, Text } from 'opub-ui'; import { - OpenContractingPartnershipTextOne, - OpenContractingPartnershipTextTwo, PJMcPartnershipText, TheRockefellerFoundationTextOne, } from '@/config/consts'; @@ -14,6 +12,23 @@ import { MediaRendering } from '@/components/media-rendering'; export function SupportedBy() { const [showMore, setShowMore] = useState(false); + const [isDescriptionLong, setIsDescriptionLong] = useState(false); + + const descriptionRef = useRef(null); + const toggleShowMore = (event: React.MouseEvent) => { + event.preventDefault(); // Prevent link navigation + event.stopPropagation(); // Stop event from propagating to the card's link + setShowMore((prevState) => !prevState); + }; + + useEffect(() => { + if (descriptionRef.current) { + const isLong = + descriptionRef.current.scrollHeight > + descriptionRef.current.clientHeight; + setIsDescriptionLong(isLong); + } + }, []); return (
Supported By -
+
- - {TheRockefellerFoundationTextOne} - - - For more information, sign up for their newsletter at{' '} - {' '} - and follow them on X @RockefellerFdn. - + + {TheRockefellerFoundationTextOne} For more information, sign + up for their newsletter at{' '} + + rockefellerfoundation.org + {' '} + and follow them on X @RockefellerFdn + +
+ + {/* Only show the "Show more" button on medium and small screens */} + {isDescriptionLong && ( +
+ +
+ )} +
-
+
- - {PJMcPartnershipText} - +
+
+ + {PJMcPartnershipText} + +
+ + {/* Only show the "Show more" button on medium and small screens */} + {isDescriptionLong && ( +
+ +
+ )} +
diff --git a/app/[locale]/about-us/components/teams.tsx b/app/[locale]/about-us/components/teams.tsx index 3479ed4..87575a0 100644 --- a/app/[locale]/about-us/components/teams.tsx +++ b/app/[locale]/about-us/components/teams.tsx @@ -1,3 +1,4 @@ +import { useEffect, useRef, useState } from 'react'; import Image from 'next/image'; import { Button, Text } from 'opub-ui'; @@ -6,7 +7,6 @@ import { CDLPartnershipTextThree, CDLPartnershipTextTwo, OpenContractingPartnershipTextOne, - OpenContractingPartnershipTextTwo, } from '@/config/consts'; import { handleRedirect } from '@/lib/utils'; import styles from './styles.module.scss'; @@ -43,31 +43,33 @@ const teamMembers: TeamMember[] = [ imageUrl: '/teams/bhavabhuthi.jpg', }, { - name: 'Ruthvik', - role: 'Associate Lead Engineer', - imageUrl: '/teams/ruthvik.jpg', + name: 'Saqib', + role: 'Quality Assurance Engineer', + imageUrl: '/teams/saqib.jpg', }, + { name: 'Swati', role: 'Frontend Engineer', imageUrl: '/teams/swati1.jpg' }, + { name: 'Sanjay', role: 'Frontend Engineer', imageUrl: '/teams/sanjay.jpg', }, + { - name: 'Sumit', - role: 'Senior Design Researcher', - imageUrl: '/teams/sumit.jpg', + name: 'Abhinandita', + role: 'Senior Product Designer', + imageUrl: '/teams/abhinandita.jpg', }, - { name: 'Swati', role: 'Frontend Engineer', imageUrl: '/teams/swati1.jpg' }, { - name: 'Saqib', - role: 'Quality Assurance Engineer', - imageUrl: '/teams/saqib.jpg', + name: 'Ruthvik', + role: 'Associate Lead Engineer', + imageUrl: '/teams/ruthvik.jpg', }, { - name: 'Abhinandita', - role: 'Senior Product Designer', - imageUrl: '/teams/abhinandita.jpg', + name: 'Sumit', + role: 'Senior Design Researcher', + imageUrl: '/teams/sumit.jpg', }, { name: 'Kakoli', @@ -85,6 +87,24 @@ const teamMembers: TeamMember[] = [ ]; export function TheTeam() { + const [showMore, setShowMore] = useState(false); + const [isDescriptionLong, setIsDescriptionLong] = useState(false); + + const descriptionRef = useRef(null); + const toggleShowMore = (event: React.MouseEvent) => { + event.preventDefault(); // Prevent link navigation + event.stopPropagation(); // Stop event from propagating to the card's link + setShowMore((prevState) => !prevState); + }; + + useEffect(() => { + if (descriptionRef.current) { + const isLong = + descriptionRef.current.scrollHeight > + descriptionRef.current.clientHeight; + setIsDescriptionLong(isLong); + } + }, []); return (
-
+
- - {OpenContractingPartnershipTextOne} - - - {OpenContractingPartnershipTextTwo} - +
+
+ + {OpenContractingPartnershipTextOne} + +
+ + {/* Only show the "Show more" button on medium and small screens */} + {isDescriptionLong && ( +
+ +
+ )} +
-
+
{CDLPartnershipTextOne} - - {CDLPartnershipTextTwo} - - - {CDLPartnershipTextThree} - + {/* -------------- */} + +
+
+ + {CDLPartnershipTextTwo} {CDLPartnershipTextThree} + +
+ + {/* Only show the "Show more" button on medium and small screens */} + {isDescriptionLong && ( +
+ +
+ )} +
+ {/* -------------- */}
-
+ {/*
*/} +
{teamMembers.map((member, index) => (