Skip to content

Commit cf0b304

Browse files
Ncode-93vasfvitor
andauthored
Add book cover image (#3161)
Co-authored-by: Nimish <bhardwajnimish93@gmail.com> Co-authored-by: Ayres Vitor <gitkey@virtuaires.com.br>
1 parent b2223e1 commit cf0b304

File tree

2 files changed

+101
-3
lines changed

2 files changed

+101
-3
lines changed

src/components/BookItem.astro

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
import { Image } from 'astro:assets';
3+
4+
const { image, alt = 'Book Cover', title, author, links = [] } = Astro.props;
5+
6+
interface Props {
7+
image: ImageMetadata;
8+
alt?: string;
9+
title: string;
10+
author: string;
11+
links?: Array<{
12+
preText: string;
13+
url: string;
14+
text: string;
15+
}>;
16+
}
17+
---
18+
19+
<div class="not-content">
20+
<div class="wrapper flex">
21+
<div class="image-wrapper">
22+
<Image src={image} alt={alt} class="image" />
23+
</div>
24+
<div class="content-wrapper flex">
25+
<h3 class="title">{title}</h3>
26+
<p class="author">by {author}</p>
27+
<div class="links-wrapper flex">
28+
{
29+
links.map((link) => (
30+
<p>
31+
{link.preText} <a href={link.url}>{link.text}</a>
32+
</p>
33+
))
34+
}
35+
</div>
36+
</div>
37+
</div>
38+
</div>
39+
40+
<style>
41+
.flex {
42+
display: flex;
43+
}
44+
.wrapper {
45+
flex-direction: row;
46+
align-items: center;
47+
gap: 1.5rem;
48+
width: 100%;
49+
}
50+
51+
.image {
52+
height: 100%;
53+
object-fit: cover;
54+
}
55+
56+
.image-wrapper {
57+
display: block;
58+
}
59+
60+
.content-wrapper {
61+
flex-direction: column;
62+
flex: 1;
63+
gap: 0.75rem;
64+
}
65+
66+
.links-wrapper {
67+
flex-direction: column;
68+
gap: 0.5rem;
69+
}
70+
71+
.title {
72+
font-size: 1.25rem;
73+
font-weight: bold;
74+
margin: 0;
75+
}
76+
77+
.author {
78+
font-size: 1rem;
79+
margin: 0;
80+
}
81+
</style>

src/content/docs/learn/index.mdx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ sidebar:
77

88
import { Card, CardGrid, LinkCard } from '@astrojs/starlight/components';
99
import AwesomeTauri from '@components/AwesomeTauri.astro';
10+
import BookItem from '@components/BookItem.astro';
11+
import RoseRustBook from '@assets/learn/community/HTML_CSS_JavaScript_and_Rust_for_Beginners_A_Guide_to_Application_Development_with_Tauri.png';
1012

1113
The Learning category is intended to provide end-to-end learning experiences on a Tauri related topic.
1214

@@ -48,9 +50,24 @@ This section contains learning resources created by the Community that are not h
4850

4951
### Books
5052

51-
- **HTML, CSS, JavaScript, and Rust for Beginners: A Guide to Application Development with Tauri** by James Alexander Rose
52-
- Paperback on Amazon: https://www.amazon.com/dp/B0DR6KZVVW
53-
- Free PDF version: [direct download](/assets/learn/community/HTML_CSS_JavaScript_and_Rust_for_Beginners_A_Guide_to_Application_Development_with_Tauri.pdf) (PDF 4MB)
53+
<BookItem
54+
image={RoseRustBook}
55+
title="HTML, CSS, JavaScript, and Rust for Beginners: A Guide to Application Development with Tauri"
56+
alt="HTML, CSS, JavaScript, and Rust for Beginners Book Cover"
57+
author="James Alexander Rose"
58+
links={[
59+
{
60+
preText: 'Paperback on Amazon:',
61+
text: 'Buy Here',
62+
url: 'https://www.amazon.com/dp/B0DR6KZVVW',
63+
},
64+
{
65+
preText: 'Free PDF version:',
66+
text: 'Download (PDF 4MB)',
67+
url: '/assets/learn/community/HTML_CSS_JavaScript_and_Rust_for_Beginners_A_Guide_to_Application_Development_with_Tauri.pdf',
68+
},
69+
]}
70+
/>
5471

5572
### Guides & Tutorials
5673

0 commit comments

Comments
 (0)