forked from tangly1024/NotionNext
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a990d3c
commit 99bd4f3
Showing
21 changed files
with
357 additions
and
276 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React, { useState } from 'react' | ||
|
||
/** | ||
* 翻转组件 | ||
* @param {*} props | ||
* @returns | ||
*/ | ||
export default function FlipCard(props) { | ||
const [isFlipped, setIsFlipped] = useState(false) | ||
|
||
function handleCardFlip() { | ||
setIsFlipped(!isFlipped) | ||
} | ||
|
||
return ( | ||
<div className={`flip-card ${isFlipped ? 'flipped' : ''}`} > | ||
<div className={`flip-card-front ${props.className || ''}`} onMouseEnter={handleCardFlip}>{props.frontContent}</div> | ||
<div className={`flip-card-back ${props.className || ''}`} onMouseLeave={handleCardFlip}>{props.backContent}</div> | ||
<style jsx>{` | ||
.flip-card { | ||
width: auto; | ||
height: auto; | ||
display: inline-block; | ||
position: relative; | ||
transform-style: preserve-3d; | ||
transition: transform 0.2s; | ||
} | ||
.flip-card-front, | ||
.flip-card-back { | ||
position: absolute; | ||
width: 100%; | ||
height: 100%; | ||
backface-visibility: hidden; | ||
} | ||
.flip-card-front { | ||
z-index: 2; | ||
transform: rotateY(0); | ||
background-color: #f1f1f1; | ||
} | ||
.flip-card-back { | ||
transform: rotateY(180deg); | ||
background-color: #888; | ||
} | ||
.flip-card.flipped { | ||
transform: rotateY(180deg); | ||
} | ||
`}</style> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.