Skip to content

Commit

Permalink
temporary fix to cors issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickolausen committed Nov 15, 2024
1 parent aaed362 commit fddf1e8
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/EducationCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import styles from './EducationCard.module.css'
import { EducationTitle } from '../data/Education'
import { EducationTitle } from '../model/Education'

interface IProps {
data?: EducationTitle
Expand Down
13 changes: 8 additions & 5 deletions src/components/GHRepoCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import template_img from '../assets/media/template.jpeg'
import { GHRepoDetails, languageToID } from '../data/ProjectDetails'
import { GHRepoDetails, languageToID } from '../model/ProjectDetails'

interface IProps {
data: GHRepoDetails
Expand All @@ -21,10 +21,13 @@ function GHRepoCard({ data }: IProps ) {
</div>
<h3 className='text-2xl font-bold pt-3'>&lt;{data.name}<span className='accent-clr'>/</span>&gt;</h3>
<p className='text-pretty py-3'>{data.description}</p>
<div id={tooltip_id} role="tooltip" className="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-[--accent-color] rounded-lg shadow-lg opacity-0 tooltip">
Made in {data.language}
<div className="tooltip-arrow" data-popper-arrow></div>
</div>
{
data.language &&
<div id={tooltip_id} role="tooltip" className="absolute z-10 invisible inline-block px-3 py-2 text-sm font-medium text-white bg-[--accent-color] rounded-lg shadow-lg opacity-0 tooltip">
Made in {data.language}
<div className="tooltip-arrow" data-popper-arrow></div>
</div>
}
</div>
<a href={"https://github.com/Nickolausen/"+ data.name} className='w-full exclude text-center text-white align-middle py-4 transition hover:cursor-pointer hover:bg-[--accent-color-darker] bg-[--accent-color] rounded-b-lg justify-self-end'>
VIEW ON GITHUB
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProjectCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from "react";
import { languageToID, ProjectDetails } from "../data/ProjectDetails"
import { languageToID, ProjectDetails } from "../model/ProjectDetails"

interface IProps {
project_info?: ProjectDetails
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/Education.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EducationCard from "../components/EducationCard"
import { EducationTitle, Expertise } from "../data/Education"
import { EducationTitle, Expertise } from "../model/Education"
import styles from './Education.module.css'

const from_school = [
Expand Down
34 changes: 25 additions & 9 deletions src/pages/Projects.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReactNode, useEffect, useState } from "react"
import GHRepoCard from "../components/GHRepoCard"
import { GHRepoDetails, ProjectDetails } from "../data/ProjectDetails"
import { GHRepoDetails, ProjectDetails } from "../model/ProjectDetails"
import ProjectCard from "../components/ProjectCard"

function Projects()
Expand All @@ -10,7 +10,16 @@ function Projects()
useEffect(() => {
let fetchedRepos: GHRepoDetails[] = []

fetch("https://pinned.berrysauce.me/get/Nickolausen")
// TODO: Fix CORS issue
fetch("https://pinned.berrysauce.me/get/Nickolausen",
{
method: "GET",
mode: "cors",
headers: {
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json"
}
})
.then((res) => res.json())
.then((data) => {
data.forEach((el: any) => {
Expand All @@ -26,6 +35,7 @@ function Projects()

setRepos(fetchedRepos)
})
.catch((e) => console.log(e))
}, [])

let projects: ProjectDetails[] = [
Expand Down Expand Up @@ -70,13 +80,19 @@ function Projects()
return <>
<section id="projects" className="pt-20">
<h1 className="text-5xl font-bold uppercase">Projects</h1>
<h3 className="text-primary text-3xl font-bold uppercase mt-10"><i className="fa fa-chevron-right"></i> From my GitHub's pinned repositories</h3>
<div className="pt-8 grid md:grid-cols-2 2xl:grid-cols-3 gap-5 gap-y-8 text-primary">
{
repos.map<ReactNode>((repo: GHRepoDetails, idx: number) => <GHRepoCard key={idx} data={repo}/>)
}
</div>
<h3 className="text-primary text-3xl font-bold uppercase pt-20"><i className="fa fa-chevron-right"></i> From previous work experiences</h3>
{ repos.length > 0 && <>
<h3 className="text-primary text-3xl font-bold uppercase mt-10"><i className="fa fa-chevron-right"></i> From my GitHub's pinned repositories</h3>
<div className="pt-8 grid md:grid-cols-2 2xl:grid-cols-3 gap-5 gap-y-8 text-primary">
{
repos.map<ReactNode>((repo: GHRepoDetails, idx: number) => <GHRepoCard key={idx} data={repo}/>)
}
</div>
</>}
{
repos.length > 0 ?
<h3 className={"text-primary text-3xl font-bold uppercase pt-20"} ><i className="fa fa-chevron-right"></i> From previous work experiences</h3> :
<h3 className={"text-primary text-3xl font-bold uppercase pt-10"} ><i className="fa fa-chevron-right"></i> From previous work experiences</h3>
}
<div className="pt-8 grid grid-cols-1 gap-5 text-primary">
{
projects.map<ReactNode>((proj: ProjectDetails, idx: number) => <ProjectCard key={idx} project_info={proj}/>)
Expand Down

0 comments on commit fddf1e8

Please sign in to comment.