Skip to content

Commit

Permalink
Add github button
Browse files Browse the repository at this point in the history
  • Loading branch information
danielstuart14 committed Jul 12, 2024
1 parent 5c93411 commit 4bb13ba
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
[dependencies]
dioxus = { version = "0.5", features = ["web"] }
dioxus-logger = "0.5.0"
dioxus-free-icons = { version = "0.8.6", features = ["font-awesome-solid"] }
dioxus-free-icons = { version = "0.8.6", features = ["font-awesome-solid", "font-awesome-brands"] }
protoviz = "0.5.0"
hex_color = "3.0.0"
js-sys = "0.3.69"
Expand Down
20 changes: 20 additions & 0 deletions assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,26 @@ html,body, #st-full-pg {
box-shadow: rgba(20, 52, 70, 0.2) 0 1px 0 inset;
}

.button_header {
min-width: 70px;
}

.icon_link {
color: white;
}

.icon_link:visited {
color: white;
}

.icon_link > * {
vertical-align: middle;
}

.icon_link:hover {
color: #b1b1b1;
}

.button_file {
overflow: hidden;
position: relative;
Expand Down
20 changes: 16 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ mod utils;

use dioxus::prelude::*;
use dioxus_free_icons::{
icons::fa_solid_icons::{FaCaretDown, FaCaretUp, FaPlus, FaX},
icons::{
fa_brands_icons::FaGithub,
fa_solid_icons::{FaCaretDown, FaCaretUp, FaPlus, FaX},
},
Icon,
};
use dioxus_logger::tracing::{error, Level};
Expand Down Expand Up @@ -56,7 +59,7 @@ fn app() -> Element {
"ProtoViz"
},
div { class: "header_left",
label { r#for: "file-open", class: "button",
label { r#for: "file-open", class: "button button_header",
"Open"
},
input {
Expand Down Expand Up @@ -93,7 +96,7 @@ fn app() -> Element {
}
},
}
button { class: "button",
button { class: "button button_header",
onclick: move |_| {
match serde_json::to_string_pretty(&*descriptor.read()) {
Ok(json) => {
Expand All @@ -113,7 +116,7 @@ fn app() -> Element {
}
},
div { class: "header_right",
button { class: "button",
button { class: "button button_header",
onclick: move |_| {
let cur_date = chrono::Local::now();
let file_name = cur_date.format("protoviz_%Y-%m-%d_%H-%M-%S.svg").to_string();
Expand All @@ -122,6 +125,15 @@ fn app() -> Element {
}
},
"Export SVG"
},
a { class: "icon_link",
href: "https://github.com/danielstuart14/protoviz_web",
target: "_blank",
Icon {
width: 30,
height: 30,
icon: FaGithub,
}
}
}
}
Expand Down

0 comments on commit 4bb13ba

Please sign in to comment.