|
| 1 | +--- |
| 2 | +id: blockchain |
| 3 | +title: Blockchain |
| 4 | +sidebar_position: 5 |
| 5 | +--- |
| 6 | + |
| 7 | +import { useState, useEffect } from 'react'; |
| 8 | +import { FaBookmark, FaRegBookmark } from 'react-icons/fa'; |
| 9 | + |
| 10 | +export function BookmarkButton({ id }) { |
| 11 | + const [bookmarked, setBookmarked] = useState(false); |
| 12 | + |
| 13 | + useEffect(() => { |
| 14 | + const saved = localStorage.getItem(`bookmark-${id}`); |
| 15 | + if (saved === 'true') setBookmarked(true); |
| 16 | + }, [id]); |
| 17 | + |
| 18 | + const toggleBookmark = () => { |
| 19 | + const newState = !bookmarked; |
| 20 | + setBookmarked(newState); |
| 21 | + localStorage.setItem(`bookmark-${id}`, newState); |
| 22 | + }; |
| 23 | + |
| 24 | + return ( |
| 25 | + <span |
| 26 | + onClick={toggleBookmark} |
| 27 | + style={{ |
| 28 | + position: 'absolute', |
| 29 | + top: 10, |
| 30 | + right: 10, |
| 31 | + cursor: 'pointer', |
| 32 | + color: bookmarked ? '#f39c12' : '#999', |
| 33 | + }} |
| 34 | + > |
| 35 | + {bookmarked ? <FaBookmark size={20} /> : <FaRegBookmark size={20} />} |
| 36 | + </span> |
| 37 | + ); |
| 38 | +} |
| 39 | + |
| 40 | +export const notesMeta = [ |
| 41 | + { id: 'blockchain-m1', title: 'Module 1: Introduction to Blockchain', subject: 'Blockchain', pdf: '/pdfs/blockchain/Module1 Introduction to Blockchain.pdf' }, |
| 42 | + { id: 'blockchain-m2', title: 'Module 2: Blockchain Technologies', subject: 'Blockchain', pdf: '/pdfs/blockchain/Module2 Blockchain Technologies.pdf' }, |
| 43 | + { id: 'blockchain-m3', title: 'Module 3: Programming in Blockchain', subject: 'Blockchain', pdf: '/pdfs/blockchain/Module3 Programing in Blockchain.pdf' }, |
| 44 | + { id: 'blockchain-m4', title: 'Module 4: Public Blockchain', subject: 'Blockchain', pdf: '/pdfs/blockchain/Module4 Public Blockchain.pdf' }, |
| 45 | + { id: 'blockchain-m5', title: 'Module 5: Private Blockchain', subject: 'Blockchain', pdf: '/pdfs/blockchain/Module5 Private Blockchain.pdf' }, |
| 46 | + { id: 'blockchain-m6', title: 'Module 6: Applications of Blockchain', subject: 'Blockchain', pdf: '/pdfs/blockchain/Module6 Applications of Blockchain.pdf' }, |
| 47 | +]; |
| 48 | + |
| 49 | +export default function BlockchainPage() { |
| 50 | + return ( |
| 51 | + <div> |
| 52 | + <h2>⛓️ Chapter-wise Blockchain Notes</h2> |
| 53 | + |
| 54 | + <div style={{ display: 'flex', flexWrap: 'wrap', gap: '1rem' }}> |
| 55 | + {notesMeta.map(note => ( |
| 56 | + <div |
| 57 | + key={note.id} |
| 58 | + style={{ |
| 59 | + border: '1px solid #ccc', |
| 60 | + borderRadius: 10, |
| 61 | + padding: '1rem', |
| 62 | + width: 250, |
| 63 | + background: '#f9f9f9', |
| 64 | + boxShadow: '2px 2px 8px rgba(0,0,0,0.1)', |
| 65 | + position: 'relative', |
| 66 | + }} |
| 67 | + > |
| 68 | + <BookmarkButton id={note.id} /> |
| 69 | + <h3>{note.title}</h3> |
| 70 | + <a href={note.pdf} download> |
| 71 | + 📥 Download PDF |
| 72 | + </a> |
| 73 | + </div> |
| 74 | + ))} |
| 75 | + </div> |
| 76 | + </div> |
| 77 | + ); |
| 78 | +} |
0 commit comments