-
Notifications
You must be signed in to change notification settings - Fork 179
Expand file tree
/
Copy pathFlipCard.tsx
More file actions
36 lines (33 loc) · 904 Bytes
/
FlipCard.tsx
File metadata and controls
36 lines (33 loc) · 904 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// SPDX-FileCopyrightText: the secureCodeBox authors
//
// SPDX-License-Identifier: Apache-2.0
import clsx from "clsx";
import React, { useState } from "react";
import styles from "../css/flipcard.module.scss";
const FlipCard = ({
title,
description,
imgSrc,
}: {
title: string;
description: string;
imgSrc: string;
}) => {
const [flipped, setFlipped] = useState(false);
return (
<div
onMouseEnter={() => setFlipped(true)}
onMouseLeave={() => setFlipped(false)}
className={clsx(styles.flipcard, { [styles.flipcardFlip]: flipped })}
>
<div className={styles.flipcardInner}>
<div className={styles.flipcardFront}>
<img src={imgSrc} className={styles.flipcardLogo} />
<h4>{title}</h4>
</div>
<div className={clsx(styles.flipcardBack)}>{description}</div>
</div>
</div>
);
};
export default FlipCard;