summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Wernick <j.wernick@eyeo.com>2021-06-23 20:16:51 +0200
committerJustin Wernick <j.wernick@eyeo.com>2021-06-23 20:16:51 +0200
commit50e79b002a96e91540d442d55d550d0c35573ea9 (patch)
treea05d5a0b69d9064d107af5e2a3ca4fc05dc854ef
parent33acfba9785e7e5ddfe4625c00931584815785e0 (diff)
Pull out some constants
-rw-r--r--Makefile.toml2
-rw-r--r--src/facebook.rs9
-rw-r--r--src/lib.rs1
-rw-r--r--src/links.rs2
-rw-r--r--src/twitter.rs9
5 files changed, 16 insertions, 7 deletions
diff --git a/Makefile.toml b/Makefile.toml
index 3b61cd8..3a0d93a 100644
--- a/Makefile.toml
+++ b/Makefile.toml
@@ -9,7 +9,7 @@ skip_core_tasks = true
[tasks.watch]
description = "Watch files and recompile the project on change"
run_task = [
- { name = "build" },
+ { name = "build_release" },
]
watch = true
diff --git a/src/facebook.rs b/src/facebook.rs
index 0f86382..10a5ff8 100644
--- a/src/facebook.rs
+++ b/src/facebook.rs
@@ -1,4 +1,7 @@
-use crate::Msg;
+use crate::{
+ links::{LINK_REL, SMALL_SHARING_FONT},
+ Msg,
+};
use seed::{prelude::*, *};
const FB_BLUE: &'static str = "#1877f2";
@@ -21,14 +24,14 @@ pub fn link(url: &str) -> Node<Msg> {
attrs! {
At::Href => facebook_url,
At::Target => "_blank",
- At::Rel => "nofollow noopener noreferrer"
+ At::Rel => LINK_REL
},
style! {
St::Display => "inline-block",
St::TextDecoration => "none",
St::Background => FB_BLUE,
St::Color => "white",
- St::Font => "bold 11px Helvetica, Arial, sans-serif",
+ St::Font => SMALL_SHARING_FONT,
St::Padding => "4px 7px",
St::BorderRadius => "3px",
},
diff --git a/src/lib.rs b/src/lib.rs
index 684c581..1429fe9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,6 +6,7 @@ use structform::StructForm;
mod facebook;
mod form;
+mod links;
mod twitter;
fn init(_: Url, _: &mut impl Orders<Msg>) -> Model {
diff --git a/src/links.rs b/src/links.rs
new file mode 100644
index 0000000..16fce3f
--- /dev/null
+++ b/src/links.rs
@@ -0,0 +1,2 @@
+pub const SMALL_SHARING_FONT: &'static str = "bold 11px Helvetica, Arial, sans-serif";
+pub const LINK_REL: &'static str = "nofollow noopener noreferrer";
diff --git a/src/twitter.rs b/src/twitter.rs
index d6c37af..0948637 100644
--- a/src/twitter.rs
+++ b/src/twitter.rs
@@ -1,4 +1,7 @@
-use crate::Msg;
+use crate::{
+ links::{LINK_REL, SMALL_SHARING_FONT},
+ Msg,
+};
use seed::{prelude::*, *};
const TWIT_BLUE: &'static str = "#1da1f2";
@@ -21,14 +24,14 @@ pub fn link(url: &str) -> Node<Msg> {
attrs! {
At::Href => twitter_url,
At::Target => "_blank",
- At::Rel => "nofollow noopener noreferrer"
+ At::Rel => LINK_REL,
},
style! {
St::Display => "inline-block",
St::TextDecoration => "none",
St::Background => TWIT_BLUE,
St::Color => "white",
- St::Font => "bold 11px Helvetica, Arial, sans-serif",
+ St::Font => SMALL_SHARING_FONT,
St::Padding => "4px 7px",
St::BorderRadius => "3px",
},