import { Show, type Component } from "solid-js";
import { author } from "../types/types";
import { Card } from "solid-bootstrap";

const AuthorCard: Component<{ author: author }> = (props: {
	author: author;
}) => {
	return (
		<Card class="book-card col-lg-2 col-md-3 col-sm-4">
			<Card.Img
				variant="top"
				class="padding-1"
				src={"/api/biiblan/authorcover/" + encodeURIComponent(props.author.id)}
			/>
			<Card.Body>
				<Card.Title>{props.author.name}</Card.Title>
				<Card.Subtitle>
					<a href={`/books/author/${props.author.id}`}>
						{props.author.bookCount} books
					</a>
				</Card.Subtitle>
			</Card.Body>
		</Card>
	);
};

export default AuthorCard;
