Skip to content

Commit 55f7e0f

Browse files
committed
Refactor Welcome page with ImageWithContent component
- Replace custom image and text layout with new ImageWithContent component - Simplify markup and improve code readability - Extract portrait image sources into a separate object - Maintain existing content and styling
1 parent 1fe974a commit 55f7e0f

File tree

1 file changed

+29
-46
lines changed

1 file changed

+29
-46
lines changed

src/pages/Welcome.js

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import PageTitle from '../pages/page-title';
33
import '../styles/components/welcome.scss';
44
import LinkCard from '../components/LinkCard';
55
import LinkWithDescription from '../components/LinkWithDescription';
6+
import ImageWithContent from '../components/ImageWithContent';
67
import portraitImageSmallWebp from '../images/peter/peter-stackebrandt-portrait-small.webp';
78
import portraitImageMediumWebp from '../images/peter/peter-stackebrandt-portrait-medium.webp';
89
import portraitImageLargeWebp from '../images/peter/peter-stackebrandt-portrait-large.webp';
@@ -12,59 +13,41 @@ import portraitImageLarge from '../images/peter/peter-stackebrandt-portrait-larg
1213

1314
// Main content of the page
1415
export default function Welcome() {
16+
const portraitSources = {
17+
small: portraitImageSmall,
18+
medium: portraitImageMedium,
19+
large: portraitImageLarge,
20+
smallWebp: portraitImageSmallWebp,
21+
mediumWebp: portraitImageMediumWebp,
22+
largeWebp: portraitImageLargeWebp
23+
};
24+
1525
return (
1626
<div className="welcome">
1727
<div className="welcome__container">
1828
<PageTitle />
1929

20-
<div className="welcome__intro">
21-
<div className="welcome__image-container">
22-
<picture>
23-
<source
24-
type="image/webp"
25-
srcSet={`${portraitImageSmallWebp} 200w,
26-
${portraitImageMediumWebp} 400w,
27-
${portraitImageLargeWebp} 800w`}
28-
sizes="(max-width: 768px) 200px,
29-
(max-width: 1024px) 250px,
30-
300px"
31-
/>
32-
<source
33-
type="image/jpeg"
34-
srcSet={`${portraitImageSmall} 200w,
35-
${portraitImageMedium} 400w,
36-
${portraitImageLarge} 800w`}
37-
sizes="(max-width: 768px) 200px,
38-
(max-width: 1024px) 250px,
39-
300px"
40-
/>
41-
<img
42-
src={portraitImageSmall}
43-
alt="Peter Stackebrandt"
44-
className="welcome__image"
45-
width="300"
46-
height="450"
47-
fetchpriority="high"
48-
/>
49-
</picture>
50-
</div>
51-
52-
<div className="welcome__text-content">
53-
<p className="welcome__text">
54-
Ich wohne in Feucht bei Nürnberg und habe langjährige Erfahrung in der Entwicklung von Apps und Services mit .NET. Neben meiner Leidenschaft für Webentwicklung interessiere ich mich besonders für den Einsatz von KI in der Softwareentwicklung.
55-
</p>
30+
<ImageWithContent
31+
sources={portraitSources}
32+
imageAlt="Peter Stackebrandt"
33+
imagePosition="left"
34+
imageWidth={300}
35+
className="welcome__intro"
36+
>
37+
<p className="welcome__text">
38+
Ich wohne in Feucht bei Nürnberg und habe langjährige Erfahrung in der Entwicklung von Apps und Services mit .NET. Neben meiner Leidenschaft für Webentwicklung interessiere ich mich besonders für den Einsatz von KI in der Softwareentwicklung.
39+
</p>
5640

57-
<p className="welcome__text">
58-
Diese Webseite ist eine zentrale Anlaufstelle, um mehr über meine Fertigkeiten und meine Projekte zu erfahren. Derzeit arbeite ich daran, hier öffentlich zugängliche Links zu meinen Projekten zu sammeln und zu präsentieren.
59-
</p>
41+
<p className="welcome__text">
42+
Diese Webseite ist eine zentrale Anlaufstelle, um mehr über meine Fertigkeiten und meine Projekte zu erfahren. Derzeit arbeite ich daran, hier öffentlich zugängliche Links zu meinen Projekten zu sammeln und zu präsentieren.
43+
</p>
6044

61-
<LinkWithDescription
62-
url="https://www.linkedin.com/in/peter-stackebrandt"
63-
linkText="Mein LinkedIn-Profil"
64-
description={`Ausführliche Informationen zu meinem beruflichen Profil`}
65-
/>
66-
</div>
67-
</div>
45+
<LinkWithDescription
46+
url="https://www.linkedin.com/in/peter-stackebrandt"
47+
linkText="Mein LinkedIn-Profil"
48+
description={`Ausführliche Informationen zu meinem beruflichen Profil`}
49+
/>
50+
</ImageWithContent>
6851

6952
<p className="welcome__section-title">Projekte</p>
7053
<ul className="welcome__list">

0 commit comments

Comments
 (0)