Changed portfolio project card div to a

This commit is contained in:
Kim, Jimin 2022-02-14 10:08:08 +09:00
parent f8c11a3fd1
commit f22aa1dadd

View file

@ -1,17 +1,24 @@
import { useEffect, useState } from "react"
import styled from "styled-components" import styled from "styled-components"
import { useNavigate } from "react-router-dom" import { Link } from "react-router-dom"
import Badge from "../../components/Badge" import Badge from "../../components/Badge"
import Card from "../../components/Card" import { cardCSS } from "../../components/Card"
import { PortfolioProject } from "../../../types/types" import { PortfolioProject } from "../../../types/types"
import theming from "../../styles/theming" import theming from "../../styles/theming"
import { useEffect, useState } from "react"
const StyledProjectCard = styled(Card)` const StyledProjectCard = styled.div`
${cardCSS}
${theming.styles.hoverCard}
margin-bottom: 2rem; margin-bottom: 2rem;
${theming.styles.hoverCard} color: ${(props) =>
theming.theme(props.theme.currentTheme, {
light: theming.light.color1,
dark: theming.dark.color1,
})};
` `
const StyledImg = styled.img` const StyledImg = styled.img`
@ -30,23 +37,22 @@ const ProjectCard = (props: ProjectCardProps) => {
const { projectID, project } = props const { projectID, project } = props
const [badges, setBadges] = useState<JSX.Element[]>([]) const [badges, setBadges] = useState<JSX.Element[]>([])
const navigate = useNavigate()
useEffect(() => { useEffect(() => {
setBadges(project.badges.map((badge) => <Badge key={badge} slug={badge} />)) setBadges(project.badges.map((badge) => <Badge key={badge} slug={badge} />))
}, []) }, [])
return ( return (
<StyledProjectCard <Link to={process.env.PUBLIC_URL + projectID}>
onClick={() => navigate(process.env.PUBLIC_URL + projectID)} <StyledProjectCard>
> <h1>{project.name}</h1>
<h1>{project.name}</h1> <StyledImg src={project.image} />
<StyledImg src={project.image} />
{badges} {badges}
<hr /> <hr />
<div dangerouslySetInnerHTML={{ __html: project.overview }} /> <div dangerouslySetInnerHTML={{ __html: project.overview }} />
</StyledProjectCard> </StyledProjectCard>
</Link>
) )
} }