Advertisement
lodha1503

Untitled

Feb 7th, 2024
738
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from "react";
  2. import tw from "twin.macro";
  3. import styled, { css } from "styled-components/macro";
  4. import { Container, ContentWithPaddingXl } from "components/misc/Layouts.js";
  5. import { SectionHeading, Subheading as SubheadingBase } from "components/misc/Headings.js";
  6. import { SectionDescription } from "components/misc/Typography.js";
  7.  
  8. const HeadingContainer = tw.div``;
  9. const Heading = tw(SectionHeading)``;
  10. const Subheading = tw(SubheadingBase)`text-center mb-3 font-Lato`;
  11. const Description = tw(SectionDescription)`mx-auto text-center`;
  12.  
  13. // Adjusted for dynamic sizing
  14. const CardsContainer = tw.div`flex flex-wrap justify-center -mx-4`;
  15. const Card = styled.div`
  16.   ${tw`mt-24 flex flex-col items-center px-4`}
  17.   width: ${props => props.isLarge ? 'calc(25% - 2rem)' : 'calc(16.66667% - 2rem)'};
  18. `;
  19.  
  20.  
  21. // Use inline styles for dynamic image size based on role
  22. const CardImage = styled.div`
  23.   ${props => css`background-image: url("${props.imageSrc}");`}
  24.   ${tw`bg-no-repeat bg-cover bg-center rounded-full`}
  25.   width: ${props => (props.isLarge ? '200px' : '130px')};
  26.   height: ${props => (props.isLarge ? '200px' : '130px')};
  27.   border: 2px solid orange;
  28.   box-shadow: 0 0 10px orange ; /* Add border shadow */
  29.  
  30. `;
  31.  
  32.  
  33. const CardContent = styled.div`
  34.   ${tw`flex flex-col items-center mt-6`}
  35.  
  36.   .position {
  37.     ${tw`uppercase text-lg font-bold tracking-widest  text-orange-600 font-Philosopher`}
  38.   }
  39.  
  40.   .name {
  41.     ${tw`mt-2 text-xl text-center font-semibold text-orange-500 font-Lato`}
  42.     ${props => !props.isLarge && css`font-size: 1rem;`} /* Smaller font size for Assistant Heads */
  43.   }
  44. `;
  45.  
  46.  
  47. const CardLinks = styled.div`
  48.   ${tw`mt-6 flex justify-center`}
  49.   .link {
  50.     ${tw`mr-8 last:mr-0 text-black hocus:text-black transition duration-300 font-Philosopher`}
  51.     .icon {
  52.       ${tw`fill-current w-6 h-6`}
  53.       color: ${props => props.iconColor || '#0000ff60'}; /* Fallback color */
  54.     }
  55.   }
  56. `;
  57.  
  58.  
  59. export default ({
  60.   heading = "Meet These Fine Folks.",
  61.   subheading = "",
  62.   cards = []
  63. }) => {
  64.   // Filter cards into two groups
  65.   const heads = cards.filter(card => card.position.toLowerCase().includes("head") && !card.position.toLowerCase().includes("assistant"));
  66.   const assistantHeads = cards.filter(card => card.position.toLowerCase().includes("assistant"));
  67.  
  68.   return (
  69.     <Container>
  70.       <ContentWithPaddingXl>
  71.         <HeadingContainer>
  72.           {subheading && <Subheading>{subheading}</Subheading>}
  73.           {heading && <Heading>{heading}</Heading>}
  74.         </HeadingContainer>
  75.         {/* Heads */}
  76.         <CardsContainer>
  77.           {heads.map((card, index) => (
  78.             <Card key={index} isHead={true} isLarge={index < 3}> {/* Update here for dynamic class application */}
  79.               <div className="card-image-background">
  80.                 <CardImage imageSrc={card.imageSrc} isLarge={true} /> {/* Assume all heads are large */}
  81.               </div>
  82.               <CardContent>
  83.                 <span className="position">{card.position}</span>
  84.                 <span className="name">{card.name}</span>
  85.                 <CardLinks>
  86.                   {card.links.map((link, linkIndex) => (
  87.                     <a key={linkIndex} className="link" href={link.mail ? `mailto:${link.mail}` : link.url} target={link.mail ? "_self" : "_blank"} rel="noopener noreferrer">
  88.                       <link.icon className="icon" />
  89.                     </a>
  90.                   ))}
  91.                 </CardLinks>
  92.               </CardContent>
  93.             </Card>
  94.           ))}
  95.         </CardsContainer>
  96.         {/* Assistant Heads */}
  97.         <CardsContainer>
  98.           {assistantHeads.map((card, index) => (
  99.             <Card key={index}>
  100.               <div className="card-image-background">
  101.                 <CardImage imageSrc={card.imageSrc} /> {/* Assistant heads use default size */}
  102.               </div>
  103.               <CardContent>
  104.                 <span className="position">{card.position}</span>
  105.                 <span className="name">{card.name}</span>
  106.                 <CardLinks>
  107.                   {card.links.map((link, linkIndex) => (
  108.                     <a key={linkIndex} className="link" href={link.mail ? `mailto:${link.mail}` : link.url} target={link.mail ? "_self" : "_blank"} rel="noopener noreferrer">
  109.                       <link.icon className="icon" />
  110.                     </a>
  111.                   ))}
  112.                 </CardLinks>
  113.               </CardContent>
  114.             </Card>
  115.           ))}
  116.         </CardsContainer>
  117.       </ContentWithPaddingXl>
  118.     </Container>
  119.   );
  120. };
  121.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement