Hello web
This commit is contained in:
commit
edfc102710
5 changed files with 1315 additions and 0 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/target
|
||||
/dist
|
1210
Cargo.lock
generated
Normal file
1210
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
10
Cargo.toml
Normal file
10
Cargo.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
[package]
|
||||
name = "srug_website"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
time = { version = "0.3.36", features = ["macros"] }
|
||||
yew = { version = "0.21.0", features = ["csr"] }
|
8
index.html
Normal file
8
index.html
Normal file
|
@ -0,0 +1,8 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>¯\_(ツ)_/¯ SRUG: Salzburg Rust User Group</title>
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
85
src/main.rs
Normal file
85
src/main.rs
Normal file
|
@ -0,0 +1,85 @@
|
|||
use time::{macros::datetime, OffsetDateTime};
|
||||
use yew::{function_component, html, Html, Properties};
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
struct Meeting {
|
||||
date: OffsetDateTime,
|
||||
location: String,
|
||||
description: String,
|
||||
}
|
||||
|
||||
#[function_component]
|
||||
fn MeetingRow(props: &Meeting) -> Html {
|
||||
html! {
|
||||
<tr>
|
||||
<td>{ format!("{}", props.date) }</td>
|
||||
<td>{ &props.location }</td>
|
||||
<td>{ &props.description }</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Properties, PartialEq)]
|
||||
struct Meetings {
|
||||
meetings: Vec<Meeting>,
|
||||
}
|
||||
|
||||
#[function_component]
|
||||
fn MeetingsTable(props: &Meetings) -> Html {
|
||||
html! {
|
||||
<table>
|
||||
<tr>
|
||||
<th>{ "Date" }</th>
|
||||
<th>{ "Location" }</th>
|
||||
<th>{ "Description" }</th>
|
||||
</tr>
|
||||
{
|
||||
props.meetings.iter().map(|row| {
|
||||
html!{<MeetingRow date={row.date.clone()} location={row.location.clone()} description={row.description.clone()} />}
|
||||
}).collect::<Html>()
|
||||
}
|
||||
</table>
|
||||
}
|
||||
}
|
||||
|
||||
// Date::from_calendar_date(2019, Month::January, 1)
|
||||
// PrimitiveDateTime::new(date!(2019-01-01), time!(0:00)),
|
||||
// datetime!(2000-01-01 0:00 UTC)
|
||||
// .to_offset(offset!(-1))
|
||||
|
||||
#[function_component]
|
||||
fn App() -> Html {
|
||||
let meetings = vec![
|
||||
Meeting {
|
||||
date: datetime!(2023-11-28 18:30 +1:00),
|
||||
location: "CCCSBG Space".into(),
|
||||
description: "Hello World!".into(),
|
||||
},
|
||||
Meeting {
|
||||
date: datetime!(2024-01-23 18:00 +1:00),
|
||||
location: "CCCSBG Space".into(),
|
||||
description: "Hello World, again!".into(),
|
||||
},
|
||||
Meeting {
|
||||
date: datetime!(2024-04-30 18:00 +2:00),
|
||||
location: "CCCSBG Space".into(),
|
||||
description: "All your web are belong to us!".into(),
|
||||
},
|
||||
];
|
||||
|
||||
html! {
|
||||
<>
|
||||
<h1>{ "¯\\_(ツ)_/¯ SRUG: Salzburg Rust User Group" }</h1>
|
||||
<p>{ "Eine Anhäufung von planlosen Wesen die was gerne etwas mit Rust machen würden." }</p>
|
||||
<MeetingsTable meetings={meetings} />
|
||||
<footer>
|
||||
<p>{ "CCCSBG Space in der Arge Kultur, Ulrike-Gschwandtner-Straße 5, 5020 Salzburg" }</p>
|
||||
<a href="https://cccsbg.at">{ "CCCSBG" }</a>
|
||||
</footer>
|
||||
</>
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
yew::Renderer::<App>::new().render();
|
||||
}
|
Loading…
Reference in a new issue