Skip to content

Commit 0889362

Browse files
committed
updated bootstrap example
1 parent 66ef68a commit 0889362

2 files changed

Lines changed: 11 additions & 14 deletions

File tree

examples/bootstrap/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ chrono = { version = "0.4", features=["serde"] }
1010
console_error_panic_hook = "0.1"
1111
console_log = "1"
1212
log = "0.4"
13-
serde = "1"
1413
async-trait = "0.1"
1514

1615
[dev-dependencies]

examples/bootstrap/src/main.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
use async_trait::async_trait;
21
use chrono::NaiveDate;
32
use leptos::*;
43
use leptos_struct_table::*;
5-
use serde::{Deserialize, Serialize};
64

75
// This generates the component BookTable
8-
#[derive(TableComponent, Serialize, Deserialize, Debug, Clone, Default, PartialEq)]
9-
#[table(sortable, classes_provider = "BootstrapClassesPreset")]
6+
#[derive(TableRow, Clone)]
7+
#[table(
8+
sortable,
9+
classes_provider = "BootstrapClassesPreset",
10+
impl_vec_data_provider
11+
)]
1012
pub struct Book {
11-
#[table(key)]
1213
pub id: u32,
1314
pub title: String,
1415
pub author: String,
15-
// TODO:
16-
// #[table(
17-
// cell_class = "text-red-600 dark:text-red-400",
18-
// head_class = "text-red-700 dark:text-red-300"
19-
// )]
2016
pub publish_date: NaiveDate,
2117
}
2218

@@ -25,7 +21,7 @@ fn main() {
2521
console_error_panic_hook::set_once();
2622

2723
mount_to_body(|| {
28-
let items = create_rw_signal(vec![
24+
let rows = vec![
2925
Book {
3026
id: 1,
3127
title: "The Great Gatsby".to_string(),
@@ -50,11 +46,13 @@ fn main() {
5046
author: "James Joyce".to_string(),
5147
publish_date: NaiveDate::from_ymd_opt(1922, 2, 2).unwrap(),
5248
},
53-
]);
49+
];
5450

5551
view! {
5652
<div class="container".to_string()>
57-
<BookTable class="table-hover".to_string() items=items />
53+
<table class="table-hover">
54+
<TableContent rows />
55+
</table>
5856
</div>
5957
}
6058
})

0 commit comments

Comments
 (0)