Skip to content

Commit e4a31a2

Browse files
committed
Added hover effect to project images
1 parent 7910ba6 commit e4a31a2

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

components/projectsummary.js

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,41 @@ import Image from 'next/image'
22

33
import LinkButton from '../components/linkbutton'
44

5-
const ProjectSummary = ({title="title", text=["text"], liveLink, repoLink, imageSource}) => {
6-
for (let line = 0; line < text.length; line++) {
7-
text[line] = <p key={line}>{text[line]}</p>;
8-
}
9-
if (liveLink) {
10-
liveLink = <LinkButton href={liveLink} text="See live" target="_blank" />
11-
}
12-
if (repoLink) {
13-
repoLink = <LinkButton href={repoLink} text="Git Repo" target="_blank" inverted={true} />
5+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
6+
import { faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'
7+
8+
const ProjectSummary = (props) => {
9+
const text = []
10+
for (let line = 0; line < props.text.length; line++) {
11+
text.push(<p key={line}>{props.text[line]}</p>);
1412
}
15-
if (imageSource) {
16-
imageSource = <img className="object-cover object-top aspect-[4/3] absolute top-[4%] left-[11.5%] w-[77%] h-[86%]" src={imageSource}></img>
13+
let liveLinkButton;
14+
if (props.liveLink) liveLinkButton = <LinkButton href={props.liveLink} text="See live" target="_blank" />;
15+
let repoLinkButton;
16+
if (props.repoLink) repoLinkButton = <LinkButton href={props.repoLink} text="Git Repo" target="_blank" inverted={true} />;
17+
let image;
18+
if (props.imageSource) {
19+
image = <img className="absolute" src={props.imageSource}></img>
1720
}
1821
return (
1922
<div className="grid gap-8 md:grid-cols-[1.5fr,1fr] items-center">
2023
<div className="relative">
2124
<img className="w-full" src="laptop.svg"></img>
22-
{imageSource}
25+
<div className="absolute top-[4%] left-[11.5%] w-[77%] h-[86%] overflow-hidden">
26+
{image}
27+
<a className="w-full h-full absolute uppercase text-center transition-opacity duration-300 opacity-0 hover:opacity-100 backdrop-blur-sm backdrop-brightness-50 flex justify-center items-center"
28+
href={props.liveLink ? props.liveLink : props.repoLink} target="_blank">
29+
<div className="bg-white border-2 border-neutral-600 rounded-full w-12 h-12 text-base flex justify-center items-center">
30+
<FontAwesomeIcon icon={faArrowUpRightFromSquare} />
31+
</div>
32+
</a>
33+
</div>
2334
</div>
2435
<div className="flex flex-col items-center md:items-start gap-4">
25-
<h2 className="font-bold text-3xl">{title}</h2>
36+
<h2 className="font-bold text-3xl">{props.title}</h2>
2637
{text}
27-
{liveLink}
28-
{repoLink}
38+
{liveLinkButton}
39+
{repoLinkButton}
2940
</div>
3041
</div>
3142
)

0 commit comments

Comments
 (0)