Skip to content

Commit

Permalink
Updating some pages
Browse files Browse the repository at this point in the history
- Updated the experience page to cope with the Markdown description
- Updated the education page to cope with the Markdown description
- Deleted unnecessary logs
  • Loading branch information
shawkyebrahim2514 committed Nov 26, 2024
1 parent 0e8dd9e commit 3095857
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 83 deletions.
8 changes: 0 additions & 8 deletions react-frontend/src/APIs/Sanity/experience.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,14 @@ const getExperiencePage = async () => {
internshipsSection {
title,
internships[] -> {
title,
subTitle,
date,
link,
description,
"technologies": technologies[]->name
}
},
certificatesSection {
title,
certificates[] -> {
title,
subTitle,
description,
date,
link,
}
}
}`;
Expand Down
8 changes: 0 additions & 8 deletions react-frontend/src/Types/sanity/educationPage.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import { CommonTitle } from "./common";

type Date = {
start: string;
end: string;
}

type Course = {
description: string;
technologies: string[];
}

export type SanityEducationPage = CommonTitle & {
education: {
name: string;
description: string;
location: string;
date: Date;
courses: Course[];
}
}
9 changes: 0 additions & 9 deletions react-frontend/src/Types/sanity/experiencePage.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { CommonTitle } from "./common";

type Date = {
from: string;
to: string;
}

type Experience = {
title: string;
subTitle: string;
date: Date;
link: string;
description: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ type AncherLinkMarkdownProps = {
} & React.HTMLAttributes<HTMLAnchorElement>;

const AncherLinkMarkdown = ({ node, ...props }: AncherLinkMarkdownProps) => {
console.log("Title: ", props.children);
console.log("Link: ", node?.properties?.href);
const title = props.children as string;
const link = node?.properties?.href as string;
const matchButtonLink = /\[(.*)\]/.exec(title);
Expand Down
9 changes: 0 additions & 9 deletions react-frontend/src/components/HTMLMarkdown/SpanMarkdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ const SpanMarkdown = ({ node, ...props }: SpanMarkdownProps) => {
let text = currentNodes[0].value;
visit(node as Element, 'text', (textNode: Text) => {
text = textNode.value;
// console.log("text: ", text);
const matchHighlightAreaWithSecondaryColor = text.match(/^!-(.*?)-!/g);
const matchHighlightAreaWithBaseColor = text.match(/^-(.*?)-/g);
const matchHighlightTextWithSecondaryColor = text.match(/^!(.*?)!/g);
Expand Down Expand Up @@ -63,12 +62,6 @@ const SpanMarkdown = ({ node, ...props }: SpanMarkdownProps) => {
} else if (matchHighlightTextWithSecondaryColor) {
className.push("secondary");
}
console.log("text: ", text);
console.log("className: ", className);
console.log("matchHighlightAreaWithSecondaryColor: ", matchHighlightAreaWithSecondaryColor);
console.log("matchHighlightAreaWithBaseColor: ", matchHighlightAreaWithBaseColor);
console.log("matchHighlightTextWithSecondaryColor: ", matchHighlightTextWithSecondaryColor);

// Delete the first and last node
currentNodes.shift();
currentNodes.pop();
Expand All @@ -86,8 +79,6 @@ const SpanMarkdown = ({ node, ...props }: SpanMarkdownProps) => {
}))
), [content]);

// console.log("Content: ", content);

const textStyle = useMemo((): CSSProperties => {
return {
position: "relative",
Expand Down
4 changes: 2 additions & 2 deletions react-frontend/src/components/ProjectCard/Image/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState, useMemo, CSSProperties } from 'react'
import { useThemeContext } from '../../../contexts/ThemeContext';
import ImageOverlay from './ImageOverlay';
// import ImageOverlay from './ImageOverlay';
import MainImage from './MainImage';

export type ImageProps = {
Expand Down Expand Up @@ -32,7 +32,7 @@ export default function Image({ imgSrc, isSmallScreen }: ImageProps) {
onBlur={() => { setIsHovered(false) }}
style={imageFrameStyle} >
<MainImage imgSrc={imgSrc} isHovered={isHovered} />
<ImageOverlay isHovered={isHovered} />
{/* <ImageOverlay isHovered={isHovered} /> */}
</div>
)
}

This file was deleted.

7 changes: 4 additions & 3 deletions react-frontend/src/containers/Education/Content/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CSSProperties, memo, useMemo } from "react";
import { SanityEducationPage } from "../../../Types";
import MainSection from "../../../components/MainSection";
import EducationInformation from "./EducationInformation";
import CoursesItems from "./CoursesItems";
import HTMLMarkdown from "../../../components/HTMLMarkdown";

function Content({ education }: Readonly<Pick<SanityEducationPage, "education">>) {
const containerStyle = useMemo((): CSSProperties => ({
Expand All @@ -14,10 +14,11 @@ function Content({ education }: Readonly<Pick<SanityEducationPage, "education">>

return (
<MainSection
title={education.name}
subtitle={education.description}>
<div style={containerStyle}>
<EducationInformation location={education.location} date={education.date} />
<div>
<HTMLMarkdown markdown={education.description} />
</div>
<CoursesItems courses={education.courses} />
</div>
</MainSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ function Content({ certificates }: Readonly<Pick<SanityExperiencePage['certifica
<>
{certificates.map((certificate) => {
return (
<MainSection
key={certificate.title}
title={certificate.title}
subtitle={certificate.subTitle}
link={certificate.link} >
<MainSection key={certificate.description}>
<div style={containerStyle}>
{certificate.description && <ExperienceItemDescription description={certificate.description} />}
</div>
Expand Down
14 changes: 1 addition & 13 deletions react-frontend/src/containers/Experience/Internships/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { SanityExperiencePage } from "../../../Types";
import MainSection from "../../../components/MainSection";
import ExperienceItemDescription from "../ExperienceItemDescription";
import ListButtons from "../../../components/ListButtons";
import Text from "../../../components/Text";

function Content({ internships }: Readonly<Pick<SanityExperiencePage['internshipsSection'], 'internships'>>) {
const containerStyle = useMemo((): CSSProperties => ({
Expand All @@ -17,15 +16,8 @@ function Content({ internships }: Readonly<Pick<SanityExperiencePage['internship
<>
{internships.map((internship) => {
return (
<MainSection
key={internship.title}
title={internship.title}
subtitle={internship.subTitle}
link={internship.link} >
<MainSection key={internship.description}>
<div style={containerStyle}>
<Text variant={"body"}>
{formatDate(internship.date)}
</Text>
<ExperienceItemDescription description={internship.description} />
<ListButtons elements={internship.technologies} />
</div>
Expand All @@ -36,8 +28,4 @@ function Content({ internships }: Readonly<Pick<SanityExperiencePage['internship
)
}

function formatDate(date: SanityExperiencePage['internshipsSection']['internships'][0]['date']) {
return `From: ${date.from} - To: ${date.to}`
}

export default Content;

0 comments on commit 3095857

Please sign in to comment.