Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ project masonry #63

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions components/sections/Projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,50 @@ import Image from "next/image";
import Link from "next/link";
import { useRouter } from "next/router";
import React from "react";
import Masonry, { ResponsiveMasonry } from "react-responsive-masonry";
import { Project } from "../../lib/Project";

interface ProjectsProps {
projects: Project[];
className?: string;
id?: string;
projectsHeadline: string;
}

export const Projects: React.FC<ProjectsProps> = ({
projects,
className,
projectsHeadline,
id = undefined,
}) => {
const { locale } = useRouter();
return (
<motion.div
id={id}
className={className}
className="min-h-1/4 mb-60 w-full snap-center text-center px-5 lg:px-14"
initial={{ opacity: 0 }}
whileInView={{ opacity: 1, transition: { duration: 1 } }}
>
<h2 className="mb-6 block w-full text-4xl font-semibold leading-tight md:mb-8 md:w-auto">
<span dangerouslySetInnerHTML={{ __html: projectsHeadline }} />
</h2>

{projects.map((project) => (
<Link
href={`/${locale}/projects/${project.slug}`}
key={project.title}
passHref
className="drop-shadow-xl inline-block drop-shadow-skill-circle transition-opacity duration-300 hover:opacity-90 md:w-96"
>
<Image
src={project.headerImage.src}
alt={project.headerImage.alt}
height={project.headerImage.height}
width={project.headerImage.width}
/>
</Link>
))}
<ResponsiveMasonry>
<Masonry gutter="1.75rem">
{projects.map((project) => (
<Link
href={`/${locale}/projects/${project.slug}`}
key={project.title}
passHref
className="shadow-lg transition-opacity duration-300 hover:opacity-90 w-full"
>
<Image
src={project.headerImage.src}
alt={project.headerImage.alt}
height={project.headerImage.height}
width={project.headerImage.width}
/>
</Link>
))}
</Masonry>
</ResponsiveMasonry>
</motion.div>
);
};
30 changes: 30 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"react-icons": "^4.10.1",
"react-inlinesvg": "^3.0.2",
"react-markdown": "^8.0.7",
"react-responsive-masonry": "^2.1.7",
"typewriter-effect": "^2.20.1"
},
"devDependencies": {
Expand All @@ -32,6 +33,7 @@
"@types/node": "^20.4.0",
"@types/react": "^18.2.14",
"@types/react-dom": "^18.2.6",
"@types/react-responsive-masonry": "^2.1.0",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.61.0",
"autoprefixer": "^10.4.14",
Expand Down
1 change: 0 additions & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ const Index: React.FC<IndexProps> = ({
projectsHeadline={projectsHeadline}
id="projects"
projects={projects}
className="min-h-1/4 mb-60 flex w-full snap-center flex-col items-center justify-center"
/>
<Contact
budgetOptions={[
Expand Down