refactor: centralize feature card icon and color mappings; improve bio paragraph key handling
This commit is contained in:
parent
18c508bba0
commit
54d3a810d2
|
|
@ -4,6 +4,11 @@ import FeatureCardsGrid from '../FeatureCardsGrid';
|
||||||
import type { Service } from '../../data/Service';
|
import type { Service } from '../../data/Service';
|
||||||
import saschaImage from '../../assets/sascha.png';
|
import saschaImage from '../../assets/sascha.png';
|
||||||
|
|
||||||
|
// Define feature card icon and color mappings as constants
|
||||||
|
const FEATURE_CARD_ICONS = [Code, Palette, ShieldCheck, Eye] as const;
|
||||||
|
const FEATURE_CARD_COLORS = ['primary', 'secondary', 'tertiary', 'quaternary'] as const;
|
||||||
|
type FeatureCardColor = typeof FEATURE_CARD_COLORS[number];
|
||||||
|
|
||||||
interface AboutSectionProps {
|
interface AboutSectionProps {
|
||||||
name?: string;
|
name?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
|
|
@ -28,10 +33,10 @@ export default function AboutSection(props: AboutSectionProps = {}) {
|
||||||
bio = texts.bio,
|
bio = texts.bio,
|
||||||
profileImage = saschaImage,
|
profileImage = saschaImage,
|
||||||
featureCards = texts.featureCards.map((card, index) => ({
|
featureCards = texts.featureCards.map((card, index) => ({
|
||||||
icon: [Code, Palette, ShieldCheck, Eye][index] || Code,
|
icon: FEATURE_CARD_ICONS[index] || Code,
|
||||||
title: card.title,
|
title: card.title,
|
||||||
description: card.description,
|
description: card.description,
|
||||||
colorClass: (["primary", "secondary", "tertiary", "quaternary"][index] || "primary") as "primary" | "secondary" | "tertiary" | "quaternary"
|
colorClass: (FEATURE_CARD_COLORS[index])
|
||||||
}))
|
}))
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
|
@ -58,7 +63,7 @@ export default function AboutSection(props: AboutSectionProps = {}) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Personal Photo and Bio */}
|
{/* Personal Photo and Bio */}
|
||||||
<main className="about-section__content" role="main">
|
<main className="about-section__content">
|
||||||
<div className="about-section__image-wrapper">
|
<div className="about-section__image-wrapper">
|
||||||
<img
|
<img
|
||||||
src={profileImage}
|
src={profileImage}
|
||||||
|
|
@ -75,8 +80,8 @@ export default function AboutSection(props: AboutSectionProps = {}) {
|
||||||
{greeting ?? `Hi, I'm ${name}!`}
|
{greeting ?? `Hi, I'm ${name}!`}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="about-section__bio-text">
|
<div className="about-section__bio-text">
|
||||||
{bio.map((paragraph) => (
|
{bio.map((paragraph, index) => (
|
||||||
<p key={paragraph.substring(0, 50)}>{paragraph}</p>
|
<p key={index}>{paragraph}</p>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue