import React, { useEffect, useState } from 'react'; import type { ReactElement } from 'react'; import Head from 'next/head'; import Link from 'next/link'; import axios from 'axios'; import { mdiMagnify, mdiBookOpenVariant, mdiCart, mdiChevronRight, mdiStar } from '@mdi/js'; import BaseIcon from '../components/BaseIcon'; import LayoutGuest from '../layouts/Guest'; import { getPageTitle } from '../config'; export default function LandingPage() { const [books, setBooks] = useState([]); const [loading, setLoading] = useState(true); const [searchQuery, setSearchQuery] = useState(''); useEffect(() => { const fetchBooks = async () => { try { // Fetch featured books or just first 8 books const response = await axios.get('/books', { params: { limit: 8, offset: 0 } }); setBooks(response.data.rows || []); } catch (error) { console.error('Failed to fetch books:', error); } finally { setLoading(false); } }; fetchBooks(); }, []); return (
Access thousands of digital books across all genres. Read anytime, anywhere on any device.
{book.author?.name || 'Unknown Author'}
Join thousands of readers and get access to the world's best eBooks. Free trial available for new members.