💄 Fix conflicts regarding the generated CSS class names

This commit is contained in:
2024-03-21 18:32:40 +01:00
parent ceeda1a771
commit 570a969cee
15 changed files with 73 additions and 60 deletions

View File

@@ -38,3 +38,6 @@ target = "x86_64-unknown-linux-gnu"
[build-dependencies] [build-dependencies]
regex = "1.10.3" regex = "1.10.3"
[package.metadata.turf.class_names]
template = "<original_name>--<id>"

View File

@@ -69,16 +69,14 @@ $border-radius: 16px;
$geist-font-path: "../fonts/Geist"; $geist-font-path: "../fonts/Geist";
$transition-duration: 300ms;
@font-face { @font-face {
src: url("#{$geist-font-path}/Geist-Bold.woff2") format("woff2"); src: url("#{$geist-font-path}/Geist-Bold.woff2") format("woff2");
font-family: "Geist"; font-family: "Geist";
font-weight: bold; font-weight: bold;
} }
* {
font-family: "Geist";
}
body { body {
height: 100vh; height: 100vh;
width: 100vw; width: 100vw;
@@ -90,8 +88,15 @@ body {
#main { #main {
height: 100%; height: 100%;
width: 100%; width: 100%;
font-family: "Geist";
} }
::selection {
background-color: transparent;
}
// TODO: To remove once the design updated. // TODO: To remove once the design updated.
.aeroButton { .aeroButton {
height: 50%; height: 50%;

View File

@@ -7,7 +7,7 @@ pub fn AvatarSelector(cx: Scope) -> Element {
style { STYLE_SHEET }, style { STYLE_SHEET },
div { div {
class: ClassName::SELECTOR, class: ClassName::AVATAR_SELECTOR,
svg { svg {
view_box: "0 0 100 100", view_box: "0 0 100 100",
linearGradient { linearGradient {
@@ -46,7 +46,7 @@ pub fn AvatarSelector(cx: Scope) -> Element {
}, },
}, },
img { img {
class: ClassName::PICTURE, class: ClassName::AVATAR_SELECTOR_PICTURE,
src: "./images/default-avatar.png", src: "./images/default-avatar.png",
}, },
}, },

View File

@@ -1,9 +1,9 @@
.selector { .avatar-selector {
position: relative; position: relative;
height: 100%; height: 100%;
aspect-ratio: 1; aspect-ratio: 1;
.picture { &__picture {
$height: 65%; $height: 65%;
$margin: calc(100% - $height) / 2; $margin: calc(100% - $height) / 2;

View File

@@ -80,7 +80,7 @@ pub fn RegisterButton<'a>(cx: Scope<'a, ButtonProps>) -> Element<'a> {
Button { Button {
id: cx.props.id.unwrap_or(""), id: cx.props.id.unwrap_or(""),
style: ClassName::REGISTER, style: ClassName::REGISTER_BUTTON,
onclick: |event| { onclick: |event| {
if let Some(cb) = &cx.props.onclick { if let Some(cb) = &cx.props.onclick {
@@ -126,7 +126,7 @@ pub fn LoginButton<'a>(cx: Scope<'a, ButtonProps>) -> Element<'a> {
Button { Button {
id: cx.props.id.unwrap_or(""), id: cx.props.id.unwrap_or(""),
style: ClassName::LOGIN, style: ClassName::LOGIN_BUTTON,
onclick: |event| { onclick: |event| {
if let Some(cb) = &cx.props.onclick { if let Some(cb) = &cx.props.onclick {

View File

@@ -1,6 +1,6 @@
@import "../_base.scss" @import "../_base.scss"
.root { %button {
height: 100%; height: 100%;
aspect-ratio: 3.5; aspect-ratio: 3.5;
@@ -18,27 +18,31 @@
} }
} }
.register { .register-button {
@extend .root; @extend %button;
background-color: $color-ternary-90; background-color: $color-ternary-90;
}
.register:hover { &:hover {
background-color: $color-ternary-80; background-color: $color-ternary-80;
} }
.register:active {
background-color: $color-ternary-70; &:active {
background-color: $color-ternary-70;
}
} }
.login { .login-button {
@extend .root; @extend %button;
background-color: $color-secondary-90; background-color: $color-secondary-90;
}
.login:hover { &:hover {
background-color: $color-secondary-80; background-color: $color-secondary-80;
} }
.login:active {
background-color: $color-secondary-70; &:active {
background-color: $color-secondary-70;
}
} }

View File

@@ -14,12 +14,12 @@ pub fn LoadingPage(cx: Scope) -> Element {
style { STYLE_SHEET }, style { STYLE_SHEET },
div { div {
class: ClassName::ROOT, class: ClassName::LOADING,
Wallpaper {}, Wallpaper {},
div { div {
class: ClassName::SPINNER, class: ClassName::LOADING_SPINNER,
Spinner {}, Spinner {},
} }
} }

View File

@@ -1,7 +1,7 @@
@import "../_base.scss" @import "../_base.scss"
@import "./spinner.scss" @import "./spinner.scss"
.root { .loading {
height: 100%; height: 100%;
width: 100%; width: 100%;
@@ -9,7 +9,7 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
.spinner { &__spinner {
height: 5%; height: 5%;
aspect-ratio: $logo-aspect-ratio; aspect-ratio: $logo-aspect-ratio;
@@ -77,5 +77,4 @@
background-color: $greyscale-0; background-color: $greyscale-0;
} }
} }

View File

@@ -375,14 +375,14 @@ pub fn Login<'a>(cx: Scope<'a, LoginProps>) -> Element<'a> {
let avatar = match random_avatar_future.value() { let avatar = match random_avatar_future.value() {
Some(Some(svg)) => { Some(Some(svg)) => {
rsx!(div { rsx!(div {
class: ClassName::CONTENT, class: ClassName::LOGIN_FORM_PHOTO_CONTENT,
dangerous_inner_html: svg.as_str(), dangerous_inner_html: svg.as_str(),
}) })
} }
Some(None) | None => { Some(None) | None => {
warn!("No profile image set or generated, display the placeholder"); warn!("No profile image set or generated, display the placeholder");
rsx!(div { rsx!(div {
class: ClassName::CONTENT, class: ClassName::LOGIN_FORM_PHOTO_CONTENT,
img { img {
src: "./images/login-profile-placeholder.svg" src: "./images/login-profile-placeholder.svg"
} }
@@ -468,13 +468,13 @@ pub fn Login<'a>(cx: Scope<'a, LoginProps>) -> Element<'a> {
Wallpaper {}, Wallpaper {},
div { div {
class: ClassName::ROOT, class: ClassName::LOGIN,
div { div {
class: "{form_classes_str}", class: "{form_classes_str}",
div { div {
class: ClassName::PHOTO, class: ClassName::LOGIN_FORM_PHOTO,
onclick: move |_| { onclick: move |_| {
random_avatar_future.restart() random_avatar_future.restart()
@@ -484,7 +484,7 @@ pub fn Login<'a>(cx: Scope<'a, LoginProps>) -> Element<'a> {
}, },
div { div {
class: ClassName::HOMESERVER, class: ClassName::LOGIN_FORM_HOMESERVER,
TextInput { TextInput {
id: "hs_url", id: "hs_url",
r#type: "text", r#type: "text",
@@ -497,7 +497,7 @@ pub fn Login<'a>(cx: Scope<'a, LoginProps>) -> Element<'a> {
}, },
div { div {
class: ClassName::ID, class: ClassName::LOGIN_FORM_ID,
TextInput { TextInput {
r#type: "text", r#type: "text",
placeholder: "{id_placeholder}", placeholder: "{id_placeholder}",
@@ -533,21 +533,21 @@ pub fn Login<'a>(cx: Scope<'a, LoginProps>) -> Element<'a> {
}, },
div { div {
class: ClassName::SPINNER, class: ClassName::LOGIN_FORM_SPINNER,
Spinner { Spinner {
animate: **spinner_animated, animate: **spinner_animated,
}, },
}, },
div { div {
class: ClassName::REGISTER, class: ClassName::LOGIN_FORM_REGISTER_BUTTON,
RegisterButton { RegisterButton {
onclick: on_register, onclick: on_register,
}, },
}, },
div { div {
class: ClassName::LOGIN, class: ClassName::LOGIN_FORM_LOGIN_BUTTON,
LoginButton { LoginButton {
focus: true, focus: true,
onclick: on_login, onclick: on_login,

View File

@@ -1,7 +1,7 @@
@import "../_base.scss" @import "../_base.scss"
@import "./spinner.scss" @import "./spinner.scss"
.root { .login {
height: 100%; height: 100%;
width: 100%; width: 100%;
@@ -12,7 +12,9 @@
position: relative; position: relative;
top: -100vh; top: -100vh;
.form { margin-bottom: -100vh;
&__form {
$height: 95%; $height: 95%;
height: $height; height: $height;
@@ -64,13 +66,13 @@
". . . . . . . . . . ." ". . . . . . . . . . ."
; ;
transition: 300ms; transition: $transition-duration;
&.register { &.register {
grid-template-rows: $padding-row $profile-img-height auto 5% 5% 5% 5% 5% 5% 5% 5% $spinner-height 5% $button-height $padding-row; grid-template-rows: $padding-row $profile-img-height auto 5% 5% 5% 5% 5% 5% 5% 5% $spinner-height 5% $button-height $padding-row;
} }
.photo { &__photo {
grid-area: photo; grid-area: photo;
display: flex; display: flex;
@@ -82,25 +84,25 @@
overflow: hidden; overflow: hidden;
.content { &__content {
height: calc(100% + (2 * $border-big-width)); height: calc(100% + (2 * $border-big-width));
aspect-ratio: 1; aspect-ratio: 1;
} }
} }
.homeserver { &__homeserver {
grid-area: homeserver; grid-area: homeserver;
} }
.id { &__id {
grid-area: id; grid-area: id;
} }
.password { &__password {
grid-area: password; grid-area: password;
} }
.confirm-password { &__confirm-password {
grid-area: confirm; grid-area: confirm;
display: none; display: none;
@@ -109,7 +111,7 @@
} }
} }
.spinner { &__spinner {
grid-area: spinner; grid-area: spinner;
} }
@@ -117,11 +119,11 @@
width: 100%; width: 100%;
} }
.register { &__register-button {
grid-area: register; grid-area: register;
} }
.login { &__login-button {
grid-area: login; grid-area: login;
} }
} }

View File

@@ -34,7 +34,7 @@ pub fn Spinner(cx: Scope<SpinnerProps>) -> Element {
style { STYLE_SHEET }, style { STYLE_SHEET },
div { div {
class: ClassName::ROOT, class: ClassName::SPINNER,
Icon { Icon {
class: if cx.props.animate { "" } else { ClassName::PAUSED }, class: if cx.props.animate { "" } else { ClassName::PAUSED },

View File

@@ -6,7 +6,7 @@ $logo-height: calc(32px * 2);
$logo-width: calc(64px * 2); $logo-width: calc(64px * 2);
$logo-aspect-ratio: calc($logo-width / $logo-height); $logo-aspect-ratio: calc($logo-width / $logo-height);
.root { .spinner {
height: 100%; height: 100%;
width: 100%; width: 100%;

View File

@@ -57,7 +57,7 @@ pub fn TextInput<'a>(cx: Scope<'a, TextInputProps<'a>>) -> Element<'a> {
style { STYLE_SHEET }, style { STYLE_SHEET },
div { div {
class: ClassName::ROOT, class: ClassName::TEXT_INPUT,
input { input {
class: level_class, class: level_class,

View File

@@ -7,10 +7,10 @@ pub fn Wallpaper(cx: Scope) -> Element {
cx.render(rsx! { cx.render(rsx! {
style { STYLE_SHEET }, style { STYLE_SHEET },
div { div {
class: ClassName::ROOT, class: ClassName::WALLPAPER,
div { div {
class: ClassName::CONTENT, class: ClassName::WALLPAPER_CONTENT,
} }
} }
}) })

View File

@@ -1,6 +1,6 @@
@import "../_base.scss" @import "../_base.scss"
.root { .wallpaper {
height: 100%; height: 100%;
width: 100%; width: 100%;
z-index: -1; z-index: -1;
@@ -11,7 +11,7 @@
overflow: hidden; overflow: hidden;
.content { &__content {
background-image: url("./images/wallpaper-pattern.svg"); background-image: url("./images/wallpaper-pattern.svg");
background-position: center; background-position: center;