Skip to content

Commit

Permalink
Codebase Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Z-100 authored Apr 10, 2024
2 parents 3f31eb3 + e6fe4ce commit 819eaa0
Show file tree
Hide file tree
Showing 37 changed files with 97 additions and 180 deletions.
18 changes: 18 additions & 0 deletions src/components/content/ContentContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";

interface ContentContainerProps {
containers: JSX.Element[]
}

export const ContentContainer = ({ containers }: ContentContainerProps) => {

return (
<div className="w-full md:w-[50%] mx-auto flex flex-col items-center">
{containers.map((container, i) => (
<div className={`w-full my-2 px-4 border-t-[1px] border-t-light-0 md:border-none md:bg-dark-3 md:rounded-xl ${i === 0 && 'border-none'}`}>
{container}
</div>
))}
</div>
);
}
31 changes: 10 additions & 21 deletions src/components/content/ContentSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@ interface ContentSectionProps {

export const ContentSection = ({textSection, textPos = 'left'}: ContentSectionProps) => {

function mapTextToParagraph(text: string | string[], textPos: TextPos): JSX.Element {

function mapTextToP(text: string | string[], textPos: TextPos): JSX.Element {

if (typeof text !== 'string') {
if (Array.isArray(text)) {
return (
<ul className="mb-8 ml-5 list-disc">
<ul className="mb-8 ml-6 list-disc">
{text?.map((li, index) => (
<li key={index} className="mb-2">{li}</li>
))}
Expand All @@ -32,26 +31,16 @@ export const ContentSection = ({textSection, textPos = 'left'}: ContentSectionPr
);
}

if (!textSection.subTexts) {
return (
<div className="my-5">
<h1 className="mb-2">{textSection.title}</h1>
{mapTextToP(textSection.text, textPos)}
</div>
);
}

return (
<div className="my-5">
<h1 className="mb-2">{textSection.title}</h1>
{mapTextToP(textSection.text, textPos)}
{textSection.subTexts!.map((text, i) => (
<>
<h2 className="mb-1 mt-2">{text.title}</h2>
{mapTextToP(text.text, textPos)}
</>
<h2 className="mb-2">{textSection.title}</h2>
{mapTextToParagraph(textSection.text, textPos)}
{textSection.subSection && textSection.subSection.map((subSection, i) => (
<span key={i}>
<h3 className="mb-1 mt-2">{subSection.title}</h3>
{mapTextToParagraph(subSection.text, textPos)}
</span>
))}
</div>
);
}

16 changes: 8 additions & 8 deletions src/components/content/ProjectSection.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import React from 'react'
import {Link} from "react-router-dom";
import {Project} from "../../domain";

interface ProjectSectionProps {
name: string,
shortDesc: string,
desc: string,
url: string,
image: string,
project: Project;
}
export const ProjectSection = ({ name, shortDesc, desc, url, image }: ProjectSectionProps) => {
export const ProjectSection = ({ project }: ProjectSectionProps) => {

const { name, shortDesc, desc, url, img } = project;

return (
<>
<div className="p-4 m-2 bg-dark-4 border-[1px] border-light-0 w-96 h-min-48 rounded-lg shadow-md overflow-hidden hover:bg-dark-5 transition">
<span className="flex">
<img src={image}
<img src={img}
alt={name}
className="mr-5 w-20 h-20 rounded-lg"/>
<span>
<Link to={url}
target={"_blank"}
target="_blank"
className="w-full h-48 object-cover">
<h3 className="text-xl font-bold py-2 pr-2 hover:underline focus:underline text-link-2 visited:text-link-1">GitHub/{name}</h3>
</Link>
Expand Down
1 change: 1 addition & 0 deletions src/components/content/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './ContentContainer'
export * from './ContentSection'
export * from './ProjectSection'
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions src/components/footer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Footer'
3 changes: 2 additions & 1 deletion src/components/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './content'
export * from './footer'
export * from './navigation'
export * from './router'
export * from './content'
34 changes: 0 additions & 34 deletions src/components/navigation/SideBar.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/components/navigation/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export * from './Footer'
export * from './Navbar'
export * from './SideBar'
14 changes: 0 additions & 14 deletions src/domain/functions/MapContentContainers.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/domain/functions/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * from './ExtractDataFromRequest'
export * from './GroupRoutes'
export * from './MapContentContainers'
13 changes: 2 additions & 11 deletions src/domain/mock-db/text-data.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
import {TextSection} from "../models";

export const introTexts: TextSection[] = [
{
title: 'Hello there',
text:
'General Keno-...\n' +
'Anyway. Thanks for checking in!',
},
]

export const aboutMeTexts: TextSection[] = [
{
title: 'Hi there, Marvin here',
text: 'I\'m a backend dev from Switzerland, the land of the cows and the cheese and the more cows',
subTexts: [
subSection: [
{
title: 'Stuff I like',
text: [
Expand Down Expand Up @@ -56,7 +47,7 @@ export const skillsTexts: TextSection[] = [
{
title: 'Tech stack',
text: 'A rough overview of the stuff I\'ve used so far',
subTexts: [
subSection: [
{
title: 'Java',
text: [
Expand Down
2 changes: 1 addition & 1 deletion src/domain/models/TextSection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface TextSection {
title: string,
text: string | string[],
subTexts?: TextSection[],
subSection?: TextSection[],
}
4 changes: 2 additions & 2 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
src: url('/public/Montserrat-Regular.ttf');
}

h1 {
h2 {
font-size: 2rem;
}

h2 {
h3 {
font-size: 1.5rem;
}
8 changes: 3 additions & 5 deletions src/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {JSX} from 'react'
import {AboutMeContainer, AboutWebsiteContainer, SkillsContainer} from "./components";
import {mapContentContainers} from "../../domain";
import {AboutMeContainer, AboutWebsiteContainer, SkillsContainer} from "./containers";
import {ContentContainer} from "../../components";

export const HomePage = () => {

Expand All @@ -20,9 +20,7 @@ export const HomePage = () => {
<h2 className="text-4xl md:text-5xl mt-5 hover:drop-shadow-2xl">Swiss Backend Dev</h2>
</span>
</div>
<div className="w-full md:w-[50%] mx-auto">
{mapContentContainers(containers)}
</div>
<ContentContainer containers={containers}/>
</div>
);
}
1 change: 0 additions & 1 deletion src/pages/home/components/about-me/index.js

This file was deleted.

1 change: 0 additions & 1 deletion src/pages/home/components/about-website/index.js

This file was deleted.

4 changes: 0 additions & 4 deletions src/pages/home/components/index.js

This file was deleted.

14 changes: 0 additions & 14 deletions src/pages/home/components/introduction/IntroContainer.tsx

This file was deleted.

1 change: 0 additions & 1 deletion src/pages/home/components/introduction/index.js

This file was deleted.

1 change: 0 additions & 1 deletion src/pages/home/components/skills/index.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {ContentSection} from "../../../../components";
import {aboutMeTexts} from "../../../../domain";
import {ContentSection} from "../../../components";
import {aboutMeTexts} from "../../../domain";

export const AboutMeContainer = () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {ContentSection} from "../../../../components";
import {aboutWebsiteTexts} from "../../../../domain";
import {ContentSection} from "../../../components";
import {aboutWebsiteTexts} from "../../../domain";

export const AboutWebsiteContainer = () => {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import {ContentSection} from "../../../../components";
import {skillsTexts} from "../../../../domain";
import {ContentSection} from "../../../components";
import {skillsTexts} from "../../../domain";

export const SkillsContainer = () => {

Expand Down
3 changes: 3 additions & 0 deletions src/pages/home/containers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './AboutMeContainer'
export * from './AboutWebsiteContainer'
export * from './SkillsContainer'
10 changes: 5 additions & 5 deletions src/pages/projects/ProjectsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {JSX} from 'react'
import {PlannedProjectsContainer, FeaturedProjectsContainer} from "./components";
import {mapContentContainers} from "../../domain";
import {PlannedProjectsContainer, FeaturedProjectsContainer} from "./containers";
import {ContentContainer} from "../../components";

export const ProjectsPage = () => {

Expand All @@ -10,8 +10,8 @@ export const ProjectsPage = () => {
];

return (
<div className="w-full md:w-[50%] mx-auto">
{mapContentContainers(containers)}
</div>
<>
<ContentContainer containers={containers}/>
</>
);
}

This file was deleted.

2 changes: 0 additions & 2 deletions src/pages/projects/components/index.js

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion src/pages/projects/components/planned-projects/index.js

This file was deleted.

17 changes: 17 additions & 0 deletions src/pages/projects/containers/FeaturedProjectsContainer.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'
import {ProjectSection} from "../../../components";
import {featuredProjectsData} from "../../../domain";

export const FeaturedProjectsContainer = () => {

return (
<>
<h2 className="mt-5 ml-5">Featured Projects</h2>
<div className="flex flex-wrap justify-evenly py-6">
{featuredProjectsData.map((project, index) => (
<ProjectSection key={index} project={project}/>
))}
</div>
</>
)
}
Loading

0 comments on commit 819eaa0

Please sign in to comment.