|
1 | 1 | import React, { useState, useEffect } from 'react'; |
2 | 2 | import { Link } from 'react-router-dom'; |
3 | 3 | import NotebookCover from "./NotebookCover"; |
| 4 | +import useSeo from '../../hooks/useSeo'; |
| 5 | +import { ArrowLeftIcon } from '@phosphor-icons/react'; |
4 | 6 |
|
5 | 7 | const NotebooksPage = () => { |
| 8 | + useSeo({ |
| 9 | + title: 'Notebooks | Fezcodex', |
| 10 | + description: 'Explore a collection of my personal notebooks and thoughts.', |
| 11 | + keywords: ['Fezcodex', 'notebooks', 'thoughts', 'journal'], |
| 12 | + ogTitle: 'Notebooks | Fezcodex', |
| 13 | + ogDescription: 'Explore a collection of my personal notebooks and thoughts.', |
| 14 | + ogImage: 'https://fezcode.github.io/logo512.png', |
| 15 | + twitterCard: 'summary_large_image', |
| 16 | + twitterTitle: 'Notebooks | Fezcodex', |
| 17 | + twitterDescription: 'Explore a collection of my personal notebooks and thoughts.', |
| 18 | + twitterImage: 'https://fezcode.github.io/logo512.png' |
| 19 | + }); |
| 20 | + |
6 | 21 | const [notebooks, setNotebooks] = useState([]); |
| 22 | + const [loading, setLoading] = useState(true); |
7 | 23 |
|
8 | 24 | useEffect(() => { |
9 | 25 | fetch('/notebooks/notebooks.json') |
10 | 26 | .then(response => response.json()) |
11 | | - .then(data => setNotebooks(data)) |
12 | | - .catch(error => console.error('Error fetching notebooks:', error)); |
| 27 | + .then(data => { |
| 28 | + setNotebooks(data); |
| 29 | + setLoading(false); |
| 30 | + }) |
| 31 | + .catch(error => { |
| 32 | + console.error('Error fetching notebooks:', error); |
| 33 | + setLoading(false); |
| 34 | + }); |
13 | 35 | }, []); |
14 | 36 |
|
| 37 | + if (loading) { |
| 38 | + return ( |
| 39 | + <div className="py-16 sm:py-24 animate-pulse"> |
| 40 | + <div className="mx-auto max-w-7xl px-6 lg:px-8"> |
| 41 | + <div className="mx-auto max-w-2xl text-center"> |
| 42 | + <div className="h-8 bg-gray-800 rounded w-1/4 mb-4 mx-auto"></div> |
| 43 | + <div className="h-12 bg-gray-800 rounded w-3/4 mb-4 mx-auto"></div> |
| 44 | + <div className="h-6 bg-gray-800 rounded w-1/2 mb-8 mx-auto"></div> |
| 45 | + </div> |
| 46 | + <div className="mt-16 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4"> |
| 47 | + {[...Array(4)].map((_, i) => ( |
| 48 | + <div key={i} className="bg-gray-800 rounded-lg shadow-lg p-6 h-64"></div> |
| 49 | + ))} |
| 50 | + </div> |
| 51 | + </div> |
| 52 | + </div> |
| 53 | + ); |
| 54 | + } |
| 55 | + |
15 | 56 | return ( |
16 | | - <div className="p-4"> |
17 | | - <h1 className="text-2xl font-bold mb-4">Notebooks</h1> |
18 | | - <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4"> |
19 | | - {notebooks.map(notebook => ( |
20 | | - <Link key={notebook.id} to={`/notebooks/${notebook.id}`}> |
21 | | - <NotebookCover title={notebook.title} /> |
| 57 | + <div className="py-16 sm:py-24"> |
| 58 | + <div className="mx-auto max-w-7xl px-6 lg:px-8"> |
| 59 | + <div className="mx-auto max-w-2xl text-center"> |
| 60 | + <Link |
| 61 | + to="/" |
| 62 | + className="text-primary-400 hover:underline flex items-center justify-center gap-2 text-lg mb-4" |
| 63 | + > |
| 64 | + <ArrowLeftIcon className="text-xl" /> Back to Home |
22 | 65 | </Link> |
23 | | - ))} |
| 66 | + <h1 className="text-4xl font-semibold tracking-tight text-white sm:text-6xl"> |
| 67 | + My <span style={{ color: 'var(--fzcdx-spanner)' }}>Notebooks</span> |
| 68 | + </h1> |
| 69 | + <p className="mt-6 text-lg leading-8 text-gray-300"> |
| 70 | + A collection of my thoughts, notes, and explorations. |
| 71 | + </p> |
| 72 | + <div className="mt-4 text-center"> |
| 73 | + <span className="ml-2 px-3 py-1 text-base font-medium text-gray-200 bg-gray-800 rounded-full"> |
| 74 | + Total: {notebooks.length} |
| 75 | + </span> |
| 76 | + </div> |
| 77 | + </div> |
| 78 | + <div className="mt-16"> |
| 79 | + <div className="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4"> |
| 80 | + {notebooks.map(notebook => ( |
| 81 | + <Link key={notebook.id} to={`/notebooks/${notebook.id}`}> |
| 82 | + <NotebookCover title={notebook.title} /> |
| 83 | + </Link> |
| 84 | + ))} |
| 85 | + </div> |
| 86 | + </div> |
24 | 87 | </div> |
25 | 88 | </div> |
26 | 89 | ); |
|
0 commit comments