Skip to content

Commit

Permalink
chore:removed hardcoded values from the cards component and placed wi…
Browse files Browse the repository at this point in the history
…thin labelmap. removed boolean logic and used external link within Link, switched from using white to the hex value (WEB-15)
  • Loading branch information
joshuaow91 committed Mar 8, 2024
1 parent 0a08f0f commit e98e189
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
2 changes: 1 addition & 1 deletion src/app/components/cardsSection/cards.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
border-radius: 15px;
font-size: 18px;
font-weight: 900;
color: white;
color: #fff;
border: none;
cursor: pointer;
text-decoration: none;
Expand Down
39 changes: 15 additions & 24 deletions src/app/components/cardsSection/cardsSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@ interface CardData {
content: string;
buttonText: string;
href: string;
external?: boolean;
}

interface CardsSectionProps {
label: {
lblWorkshops: string;
lblSupport: string;
lblCohorts: string;
btnTextMeetup: string;
btnTextCommunity: string;
btnTextCohort: string;
meetupUrl: string;
communityUrl: string;
cohortUrl: string;
};
}

Expand All @@ -23,23 +28,20 @@ export default function CardsSection({ label }: CardsSectionProps) {
{
id: 1,
content: label.lblWorkshops,
buttonText: "Go To A Meetup",
href: "https://www.meetup.com/dallas-software-developers-meetup/",
external: true,
buttonText: label.btnTextMeetup,
href: label.meetupUrl,
},
{
id: 2,
content: label.lblSupport,
buttonText: "Community Impact",
href: "/",
external: false,
buttonText: label.btnTextCommunity,
href: label.communityUrl,
},
{
id: 3,
content: label.lblCohorts,
buttonText: "Join Our Cohort",
href: "/",
external: false,
buttonText: label.btnTextCohort,
href: label.cohortUrl,
},
];

Expand All @@ -48,20 +50,9 @@ export default function CardsSection({ label }: CardsSectionProps) {
{cardData.map((card) => (
<Card key={card.id}>
<p>{card.content}</p>
{card.external ? (
<a
href={card.href}
target="_blank"
rel="noopener noreferrer"
className={styles.button}
>
{card.buttonText} &rarr;
</a>
) : (
<Link href={card.href} className={styles.button}>
{card.buttonText} &rarr;
</Link>
)}
<Link href={card.href}>
<a className={styles.button}>{card.buttonText} &rarr;</a>
</Link>
</Card>
))}
</div>
Expand Down
6 changes: 6 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ export default function Home() {
lblWorkshops: "Technical Workshops",
lblSupport: "Community Support",
lblCohorts: "Cohorts & Hackathons",
btnTextMeetup: "Go To A Meetup",
btnTextCommunity: "Community Impact",
btnTextCohort: "Join Our Cohort",
meetupUrl: "https://www.meetup.com/dallas-software-developers-meetup/",
communityUrl: "/",
cohortUrl: "/",
};

return (
Expand Down

0 comments on commit e98e189

Please sign in to comment.