Skip to content

Commit 6110e37

Browse files
authored
Merge pull request #141 from w3bdesign/development
Animation ProsjektCard
2 parents 6baa287 + 9a0cc67 commit 6110e37

File tree

5 files changed

+75
-72
lines changed

5 files changed

+75
-72
lines changed

__tests__/Prosjekter/ProsjektCard.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import { render, screen } from "@testing-library/react";
33

4-
import ProsjektCard from "../../src/components/Prosjekter/ProsjektCard";
4+
import ProsjektCard from "../../src/components/Prosjekter/ProsjektCard.component";
55

66
// Mock the Button component
77
jest.mock(

src/app/prosjekter/page.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { client } from "@/lib/sanity/client";
33
import { groq } from "next-sanity";
44

55
import PageHeader from "@/components/UI/PageHeader.component";
6-
import ProsjektCard from "@/components/Prosjekter/ProsjektCard";
6+
import ProsjektCard from "@/components/Prosjekter/ProsjektCard.component";
77

88
export default async function Prosjekter() {
99
const projectQuery = groq`
@@ -44,8 +44,7 @@ export default async function Prosjekter() {
4444
{posts &&
4545
posts.map((project: any) => (
4646
<ProsjektCard
47-
key={project.id}
48-
id={project.id}
47+
key={project.id}
4948
name={project.name}
5049
description={project.description}
5150
subdescription={project.subdescription}

src/components/Animations/BounceInScroll.component.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { Variants, motion } from "framer-motion";
24

35
import { IAnimateBounceProps } from "./types/Animations.types";
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import React from "react";
2+
import Image from "next/image";
3+
4+
import Button from "@/components/UI/Button.component";
5+
import { urlFor } from "@/lib/sanity/helpers";
6+
import BounceInScroll from "../Animations/BounceInScroll.component";
7+
8+
interface ProjectProps {
9+
name: string;
10+
description: string;
11+
subdescription: string;
12+
projectimage: string;
13+
urlwww: Array<{ url: string; _key: string }>;
14+
urlgithub: Array<{ url: string; _key: string }>;
15+
}
16+
17+
const ProsjektCard: React.FC<ProjectProps> = ({
18+
name,
19+
description,
20+
subdescription,
21+
projectimage,
22+
urlwww,
23+
urlgithub,
24+
}) => {
25+
return (
26+
<div className="bg-slate-700 shadow-md rounded-lg overflow-hidden mx-4 md:m-0">
27+
<BounceInScroll viewAmount={0.3}>
28+
<div className="relative w-full h-48 md:h-60">
29+
<div className="w-full h-full p-5 md:pb-[50px] relative overflow-hidden flex justify-center md:w-[750px] md:h-[350px]">
30+
{projectimage && (
31+
<Image
32+
className="flex justify-center text-center"
33+
width="600"
34+
height="350"
35+
quality={100}
36+
src={urlFor(projectimage).url() as string}
37+
alt={name}
38+
priority
39+
unoptimized
40+
/>
41+
)}
42+
</div>
43+
</div>
44+
<div className="md:mt-12 p-2 flex flex-col justify-between min-h-[250px] xl:min-h-[275px]">
45+
<div>
46+
<h1 className="xl:mt-4 text-xl text-center font-bold py-2 text-slate-200">
47+
{name}
48+
</h1>
49+
<h2 className="text-md">{description}</h2>
50+
<p className="mt-4 text-sm mt-2">{subdescription}</p>
51+
</div>
52+
<div className="flex justify-center mt-4">
53+
{urlwww && urlwww.length > 0 && (
54+
<Button href={urlwww[0].url} renderAs="a">
55+
Besøk
56+
</Button>
57+
)}
58+
{urlgithub && urlgithub.length > 0 && (
59+
<Button href={urlgithub[0].url} renderAs="a">
60+
GitHub
61+
</Button>
62+
)}
63+
</div>
64+
</div>
65+
</BounceInScroll>
66+
</div>
67+
);
68+
};
69+
70+
export default ProsjektCard;

src/components/Prosjekter/ProsjektCard.tsx

Lines changed: 0 additions & 68 deletions
This file was deleted.

0 commit comments

Comments
 (0)