-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnfV3Book.jsx
More file actions
59 lines (55 loc) · 1.98 KB
/
Copy pathSnfV3Book.jsx
File metadata and controls
59 lines (55 loc) · 1.98 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import React from 'react';
import { Link } from 'react-router-dom';
import { motion } from 'framer-motion';
import { toRoman } from '../../pages/snf-v3/snfV3Utils';
// Muted, aged cloth bindings — one per volume.
const BINDINGS = [
'#7c2b2b', // oxblood
'#2f4a44', // deep teal
'#39466a', // navy
'#6b5836', // ochre
'#4a3550', // plum
'#34442f', // forest
'#5a3326', // chestnut
];
const SnfV3Book = ({ book, language = 'en' }) => {
const color = BINDINGS[(Number(book.bookId) - 1) % BINDINGS.length];
const firstEp = book.episodes?.[0];
const to = firstEp ? `/bookshelf/read/${book.bookId}/${firstEp.id}` : '/bookshelf';
const title = book.bookTitle.replace(/^Volume\s+[IVX]+:\s*/i, '');
const count = book.episodes?.length || 0;
const tr = language === 'tr';
return (
<div
className="snf3-book-wrap relative"
style={{ paddingBottom: 16, perspective: '1100px' }}
>
<div className="snf3-book-shadow" />
<motion.div
whileHover={{ rotateX: -8, rotateY: -7, y: -6, scale: 1.02, zIndex: 20 }}
whileTap={{ rotateX: -4, rotateY: -3, scale: 1.0 }}
transition={{ type: 'spring', stiffness: 240, damping: 19 }}
className="relative"
style={{ transformStyle: 'preserve-3d', transformOrigin: 'center bottom' }}
>
<Link
to={to}
className="snf3-book"
style={{ background: color }}
aria-label={title}
>
<span className="snf3-book-pages" />
<span className="snf3-book-num">VOL. {toRoman(book.bookId)}</span>
<span className="block">
<span className="snf3-book-title block">{title}</span>
<span className="snf3-book-rule" />
<span className="snf3-book-num block !text-[0.58rem] !tracking-[0.14em] opacity-85">
{count} {tr ? 'bölüm' : count === 1 ? 'chapter' : 'chapters'}
</span>
</span>
</Link>
</motion.div>
</div>
);
};
export default SnfV3Book;