1+ use std:: ops:: Deref ;
2+
13use crate :: components:: sidebar:: Sidebar ;
24use leptos:: prelude:: * ;
35// use sens8::button::*;
@@ -7,7 +9,85 @@ pub fn GardenPage() -> impl IntoView {
79 view ! {
810 <Sidebar >
911 <Hero />
10- <div class="grid grid-cols-3 gap-4 mx-auto max-w-7xl sm:px-6 lg:px-8 py-14" >posts</div>
12+ <div class="pb-24 sm:pb-32" >
13+ <div class="mx-auto max-w-7xl px-6 lg:px-8" >
14+ <div class="mx-auto mt-16 grid max-w-2xl grid-cols-1 gap-x-8 gap-y-20 lg:mx-0 lg:max-w-none lg:grid-cols-3" >
15+ <Article
16+ title="Something about Rust" . to_string( )
17+ image_url="/test-images/01JKC777W14S7H92HS5KJVKAAS.avif" . to_string( )
18+ tags=vec![
19+ Tag {
20+ display_name: "Rust" . to_string( ) ,
21+ label: "rust" . to_string( ) ,
22+ }
23+ ]
24+ />
25+ <Article
26+ title="A Bevy application" . to_string( )
27+ image_url="/test-images/01JMVAV66K6AR15Q7F0EFM1H0N.avif" . to_string( )
28+ tags=vec![
29+ Tag {
30+ display_name: "Rust" . to_string( ) ,
31+ label: "rust" . to_string( ) ,
32+ } ,
33+ Tag {
34+ display_name: "Bevy" . to_string( ) ,
35+ label: "bevy" . to_string( ) ,
36+ }
37+ ] />
38+ <Article
39+ title="Communicating between JS and Rust/Wasm" . to_string( )
40+ image_url="/test-images/01JNDKF68NC1T06KD14Z503JAG.avif" . to_string( )
41+ tags=vec![ Tag {
42+ display_name: "Rust" . to_string( ) ,
43+ label: "rust" . to_string( ) ,
44+ } ,
45+ Tag {
46+ display_name: "Wasm" . to_string( ) ,
47+ label: "wasm" . to_string( ) ,
48+ } ] />
49+ <Article
50+ title="Something about Rust" . to_string( )
51+ image_url="/test-images/01JKC777W14S7H92HS5KJVKAAS.avif" . to_string( )
52+ tags=vec![
53+ ]
54+ />
55+ <Article
56+ title="A Bevy application" . to_string( )
57+ image_url="/test-images/01JMVAV66K6AR15Q7F0EFM1H0N.avif" . to_string( )
58+ tags=vec![
59+ Tag {
60+ display_name: "Rust" . to_string( ) ,
61+ label: "rust" . to_string( ) ,
62+ } ,
63+ Tag {
64+ display_name: "Bevy" . to_string( ) ,
65+ label: "bevy" . to_string( ) ,
66+ } ,
67+ Tag {
68+ display_name: "Advent of Code" . to_string( ) ,
69+ label: "advent-of-code" . to_string( ) ,
70+ } ,
71+ Tag {
72+ display_name: "Parser Combinators" . to_string( ) ,
73+ label: "parser-combinators" . to_string( ) ,
74+ }
75+ ] />
76+ <Article
77+ title="Communicating between JS and Rust/Wasm" . to_string( )
78+ image_url="/test-images/01JNDKF68NC1T06KD14Z503JAG.avif" . to_string( )
79+ tags=vec![ Tag {
80+ display_name: "Rust" . to_string( ) ,
81+ label: "rust" . to_string( ) ,
82+ } ,
83+ Tag {
84+ display_name: "Wasm" . to_string( ) ,
85+ label: "wasm" . to_string( ) ,
86+ } ] />
87+ </div>
88+ </div>
89+ </div>
90+
1191 </Sidebar >
1292 }
1393}
@@ -29,8 +109,82 @@ pub fn Hero() -> impl IntoView {
29109 alt="party corgi rainbow animated"
30110 />
31111 </h1>
32- <p class="mt-6 text-xl text-indigo-100 max-w-3xl" >This is all of my posts</p>
112+ <p class="mt-6 text-xl text-indigo-100 max-w-3xl" >
113+ This is my digital garden, where I often build up new content. Some posts are sketches or in-progress while others are complete.
114+ </p>
33115 </div>
34116 </div>
35117 }
36118}
119+
120+ #[ component]
121+ fn Article (
122+ title : String ,
123+ image_url : String ,
124+ tags : Vec < Tag > ,
125+ ) -> impl IntoView {
126+ view ! {
127+ <article class="flex flex-col items-start justify-start" >
128+ <div class="relative w-full" >
129+ <img src={ image_url} alt="" class="aspect-video w-full rounded bg-gray-100 object-cover sm:aspect-[2/1] lg:aspect-[16/9]" />
130+ <div class="absolute inset-0 rounded-2xl ring-1 ring-inset ring-gray-900/10" ></div>
131+ </div>
132+ <div class="max-w-xl" >
133+ <div class="mt-8 flex flex-wrap items-center gap-4 text-xs" >
134+ // <time datetime="2020-03-16" class="text-gray-500">Mar 16, 2020</time>
135+ {
136+ tags. iter( ) . map( |tag| view!{
137+ <Tag tag=tag. clone( ) />
138+ } ) . collect_view( )
139+ }
140+ </div>
141+ <div class="group relative" >
142+ <h3 class="mt-3 text-lg/6 font-semibold text-indigo-100 group-hover:text-slate-100" >
143+ <a href="#" >
144+ <span class="absolute inset-0" ></span>
145+ { title. clone( ) }
146+ </a>
147+ </h3>
148+ <p class="mt-5 line-clamp-3 text-sm/6 text-slate-100" >Illo sint voluptas. Error voluptates culpa eligendi. Hic vel totam vitae illo. Non aliquid explicabo necessitatibus unde. Sed exercitationem placeat consectetur nulla deserunt vel. Iusto corrupti dicta. </p>
149+ </div>
150+ </div>
151+ </article>
152+ }
153+ }
154+
155+ #[ derive( Clone ) ]
156+ struct Tag {
157+ display_name : String ,
158+ label : String ,
159+ }
160+
161+ impl Tag {
162+ fn color_ring ( & self ) -> & str {
163+ match self . label . deref ( ) {
164+ "rust" => "ring-red-400" ,
165+ "bevy" => "ring-sky-400" ,
166+ "wasm" => "ring-indigo-400" ,
167+ _ => "ring-gray-800" ,
168+ }
169+ }
170+ fn color_fill ( & self ) -> & str {
171+ match self . label . deref ( ) {
172+ "rust" => "fill-red-400" ,
173+ "bevy" => "fill-sky-400" ,
174+ "wasm" => "fill-indigo-400" ,
175+ _ => "fill-gray-800" ,
176+ }
177+ }
178+ }
179+
180+ #[ component]
181+ fn tag ( tag : Tag ) -> impl IntoView {
182+ view ! {
183+ <span class=format!( "inline-flex items-center gap-x-1.5 rounded-md px-2 py-1 text-xs font-medium text-white ring-1 ring-inset {}" , tag. color_ring( ) ) >
184+ <svg class=format!( "size-1.5 {}" , tag. color_fill( ) ) viewBox="0 0 6 6" aria-hidden="true" >
185+ <circle cx="3" cy="3" r="3" />
186+ </svg>
187+ { tag. display_name. clone( ) }
188+ </span>
189+ }
190+ }
0 commit comments