4 Commits

Author SHA1 Message Date
f79ebb0b03 Add SearchIcon, SpacesIcon, ChatsIcon and RoomsIcon elements 2024-04-26 19:42:49 +02:00
7078f86cd8 💄 Make the "logo" shape reusable 2024-04-26 19:31:05 +02:00
894f32e177 💄 Adjust Login padding 2024-04-26 19:27:11 +02:00
3afed02aa8 🚧 Make Button usable outside of the button.rs file 2024-04-26 19:23:34 +02:00
8 changed files with 69 additions and 38 deletions

View File

@@ -10,8 +10,8 @@ web = ["dioxus/web"]
[dependencies] [dependencies]
dioxus = "0.5.*" dioxus = "0.5.*"
dioxus-free-icons = { version = "0.8", features = ["material-design-icons-navigation", "ionicons"] }
dioxus-sdk = { version = "0.5.*", features = ["utils"] } dioxus-sdk = { version = "0.5.*", features = ["utils"] }
dioxus-free-icons = { version = "0.8.*", features = ["ionicons", "font-awesome-solid", "material-design-icons-navigation"] }
# matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk.git", branch = "main", default-features = false, features = ["js", "rustls-tls"] } # matrix-sdk = { git = "https://github.com/matrix-org/matrix-rust-sdk.git", branch = "main", default-features = false, features = ["js", "rustls-tls"] }
matrix-sdk = { version = "0.7.*", default-features = false, features = ["js", "rustls-tls"] } matrix-sdk = { version = "0.7.*", default-features = false, features = ["js", "rustls-tls"] }

View File

@@ -1,14 +1,12 @@
@import "../base.scss"; @import "../base.scss";
$panel-aspect-ratio: 1/1.618; $panel-aspect-ratio: 1/1.618;
$panel-padding-v: 5%;
$panel-padding-h: 5%;
%panel { @mixin panel($padding-v: 2%, $padding-h: 2%) {
padding: $panel-padding-v $panel-padding-h; padding: $padding-v $padding-h;
height: calc(100% - $panel-padding-v - (2 * $border-big-width)); height: calc(100% - (2 * $padding-v) - (2 * $border-big-width));
width: calc(100% - $panel-padding-h - (2 * $border-big-width)); width: calc(100% - (2 * $padding-h) - (2 * $border-big-width));
flex-shrink: 0; flex-shrink: 0;
border: $border-big; border: $border-big;

View File

@@ -77,7 +77,7 @@ pub struct ButtonProps {
children: Element, children: Element,
} }
fn Button(props: ButtonProps) -> Element { pub fn Button(props: ButtonProps) -> Element {
rsx! { rsx! {
style { {STYLE_SHEET} }, style { {STYLE_SHEET} },

View File

@@ -5,16 +5,22 @@
aspect-ratio: 3.5; aspect-ratio: 3.5;
border: $border-normal; border: $border-normal;
border-radius: $border-radius; border-radius: 5%;
color: get-color(greyscale, 0); color: get-color(greyscale, 0);
font-family: "Geist"; font-family: "Geist";
font-weight: bold; font-weight: bold;
// To center the inner svg
// TODO: Find a more efficient way to center
display: flex;
align-items: center;
justify-content: center;
svg { svg {
height: 100%; height: 85%;
width: 100%; width: 85%;
text { text {
font-size: 50; font-size: 50;

View File

@@ -1,5 +1,8 @@
use const_format::formatcp; use const_format::formatcp;
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::icons::fa_solid_icons::{
FaComments, FaLayerGroup, FaMagnifyingGlass, FaPeopleGroup,
};
use dioxus_free_icons::icons::md_navigation_icons::MdArrowDropDown; use dioxus_free_icons::icons::md_navigation_icons::MdArrowDropDown;
use dioxus_free_icons::{Icon, IconShape}; use dioxus_free_icons::{Icon, IconShape};
@@ -9,13 +12,54 @@ include!(concat!(env!("OUT_DIR"), "/style_vars.rs"));
use style::{COLOR_PRIMARY_100, COLOR_TERNARY_100}; use style::{COLOR_PRIMARY_100, COLOR_TERNARY_100};
pub fn DownArrowIcon() -> Element { macro_rules! transparent_icon {
($name:ident, $icon:ident) => {
pub fn $name() -> Element {
rsx! {
style { {STYLE_SHEET} },
Icon {
class: ClassName::TRANSPARENT_ICON,
icon: $icon,
}
}
}
};
}
// TODO: Remove this icon once the conversation panel finished
transparent_icon!(DownArrowIcon, MdArrowDropDown);
transparent_icon!(SearchIcon, FaMagnifyingGlass);
transparent_icon!(SpacesIcon, FaLayerGroup);
transparent_icon!(ChatsIcon, FaComments);
transparent_icon!(RoomsIcon, FaPeopleGroup);
#[derive(Clone, PartialEq)]
pub(crate) struct LogoShape;
impl IconShape for LogoShape {
fn view_box(&self) -> &str {
"0 0 184 94"
}
fn xmlns(&self) -> &str {
"http://www.w3.org/2000/svg"
}
fn child_elements(&self) -> Element {
rsx! {
path {
"stroke-linejoin": "round",
"stroke-width": "6",
d: "M121.208 2 2 57.011l70.927-.265L61.363 92 182 36.724h-69.498L121.208 2Z"
}
}
}
}
pub fn LogoIcon() -> Element {
rsx! { rsx! {
style { {STYLE_SHEET} }, style { {STYLE_SHEET} },
Icon { Icon {
class: ClassName::DOWN_ARROW_ICON, icon: LogoShape,
icon: MdArrowDropDown,
} }
} }
} }

View File

@@ -1,4 +1,4 @@
.down-arrow-icon { .transparent-icon {
color: transparent; color: transparent;
path:last-child { path:last-child {

View File

@@ -3,7 +3,8 @@
@import "./spinner.scss"; @import "./spinner.scss";
.login { .login {
@extend %panel; $padding: 5%;
@include panel($padding, $padding);
$aspect-ratio: var(--aspect-ratio); $aspect-ratio: var(--aspect-ratio);

View File

@@ -1,28 +1,10 @@
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_free_icons::{Icon, IconShape}; use dioxus_free_icons::Icon;
use crate::ui::components::icons::LogoShape;
turf::style_sheet!("src/ui/components/spinner.scss"); turf::style_sheet!("src/ui/components/spinner.scss");
#[derive(Clone, PartialEq)]
struct _Spinner;
impl IconShape for _Spinner {
fn view_box(&self) -> &str {
"0 0 184 94"
}
fn xmlns(&self) -> &str {
"http://www.w3.org/2000/svg"
}
fn child_elements(&self) -> Element {
rsx! {
path {
"stroke-linejoin": "round",
"stroke-width": "6",
d: "M121.208 2 2 57.011l70.927-.265L61.363 92 182 36.724h-69.498L121.208 2Z"
}
}
}
}
#[derive(PartialEq, Clone, Props)] #[derive(PartialEq, Clone, Props)]
pub struct SpinnerProps { pub struct SpinnerProps {
#[props(default = true)] #[props(default = true)]
@@ -38,7 +20,7 @@ pub fn Spinner(props: SpinnerProps) -> Element {
Icon { Icon {
class: if props.animate { "" } else { ClassName::PAUSED }, class: if props.animate { "" } else { ClassName::PAUSED },
icon: _Spinner, icon: LogoShape,
} }
} }
} }