mirror of
https://github.com/hazemKrimi/personal-website.git
synced 2026-05-02 02:10:27 +00:00
Add click handler to card component
This commit is contained in:
+3
-2
@@ -6,6 +6,7 @@ interface Props {
|
|||||||
title: string;
|
title: string;
|
||||||
description: string;
|
description: string;
|
||||||
tags?: string[];
|
tags?: string[];
|
||||||
|
onClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const StyledCard = styled.div<{ dark: boolean }>`
|
const StyledCard = styled.div<{ dark: boolean }>`
|
||||||
@@ -44,11 +45,11 @@ const StyledCard = styled.div<{ dark: boolean }>`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Card: FC<Props> = ({ title, description, tags }) => {
|
const Card: FC<Props> = ({ title, description, tags, onClick }) => {
|
||||||
const { dark } = useContext(DarkModeContext);
|
const { dark } = useContext(DarkModeContext);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledCard dark={dark}>
|
<StyledCard dark={dark} onClick={onClick}>
|
||||||
<div>
|
<div>
|
||||||
<h3>{title}</h3>
|
<h3>{title}</h3>
|
||||||
<p>{description}</p>
|
<p>{description}</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user