Skip to content

Commit 60219ff

Browse files
committed
feat: interactive book
1 parent 3137154 commit 60219ff

3 files changed

Lines changed: 13 additions & 11 deletions

File tree

src/components/stateless/InteractiveBook/index.module.less

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -366,14 +366,12 @@
366366
border-radius: 0 4px 4px 0;
367367
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
368368
border: 1px solid #e5e5e5;
369-
transform: translateZ(-1px);
370-
z-index: -1;
371369
display: flex;
372370
flex-direction: column;
373371
align-items: center;
374372
justify-content: center;
375373
text-align: center;
376-
opacity: 0.4;
374+
opacity: 0.6;
377375
}
378376

379377
.endText {
@@ -406,7 +404,6 @@
406404
position: absolute;
407405
bottom: 20px;
408406
left: 50%;
409-
transform: translateX(-50%);
410407
display: flex;
411408
align-items: center;
412409
gap: 24px;

src/components/stateless/InteractiveBook/index.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,12 @@ export default function InteractiveBook({
229229
})}
230230

231231
{/* Back Cover (Static) */}
232-
<div className={styles.backCover} style={{ transform: 'translateZ(-1px)', zIndex: -1 }}>
232+
<div
233+
className={styles.backCover}
234+
style={{
235+
zIndex: currentPageIndex === pages.length - 1 ? 50 : -1,
236+
}}
237+
>
233238
<div className={styles.backCover}>
234239
<p className={styles.endText}>The End</p>
235240
<motion.button
@@ -249,9 +254,9 @@ export default function InteractiveBook({
249254
<AnimatePresence>
250255
{isOpen && (
251256
<motion.div
252-
initial={{ opacity: 0, y: 20, transform: 'translateX(-50%)' }}
253-
animate={{ opacity: 1, y: 0, transform: 'translateX(-50%)' }}
254-
exit={{ opacity: 0, y: 20, transform: 'translateX(-50%)' }}
257+
initial={{ opacity: 0, y: 20, x: '-50%' }}
258+
animate={{ opacity: 1, y: 0, x: '-50%' }}
259+
exit={{ opacity: 0, y: 20, x: '-50%' }}
255260
transition={{ duration: 0.4, ease: 'easeOut' }}
256261
className={cn(styles.navigation)}
257262
>

src/pages/home/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,9 @@ const Home = () => {
564564
]
565565
return (
566566
<FixTabPanel ref={scrollRef}>
567+
<section className={styles.avatar} style={{ margin: '10px 0', fontSize: 24 }}>
568+
<ColorfulText text={`React version: ${version}`} />
569+
</section>
567570
<InteractiveBook
568571
coverImage="https://images.unsplash.com/photo-1544947950-fa07a98d237f?auto=format&fit=crop&q=80&w=800"
569572
bookTitle="The Design of Everyday Things"
@@ -572,9 +575,6 @@ const Home = () => {
572575
width={350}
573576
height={500}
574577
/>
575-
<section className={styles.avatar} style={{ margin: '10px 0', fontSize: 24 }}>
576-
<ColorfulText text={`React version: ${version}`} />
577-
</section>
578578
<section style={{ width: '320px', margin: '30px 0' }}>
579579
<Input defaultValue={apiKey} placeholder="api key" onChange={changeApiKey} style={{ marginBottom: 20 }} />
580580
<Flex align="center">

0 commit comments

Comments
 (0)