Skip to content

Commit

Permalink
☎️ Feature: mobile view (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeFTN authored Dec 3, 2024
2 parents f1f555f + 9d456a3 commit 93ffa9f
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 17 deletions.
2 changes: 1 addition & 1 deletion web/Dioxus.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ watch_path = ["src", "assets"]

# CSS style file

style = ["main.css"]
style = ["styles/main.css"]

# Javascript code file
script = []
Expand Down
3 changes: 3 additions & 0 deletions web/assets/blog.css → web/assets/styles/blog.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
.blog {
.title {
color: #cdd6f4;
margin-left: 10px;
}
.subtitle {
color: #bac2de;
margin-left: 10px;
}
.not-found {
color: #babbf1;
text-align: center;
}
}
3 changes: 3 additions & 0 deletions web/assets/books.css → web/assets/styles/books.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
.books {
.title {
color: #cdd6f4;
margin-left: 10px;
}
.subtitle {
color: #bac2de;
margin-left: 10px;
}
.not-found {
color: #babbf1;
text-align: center;
}
}
8 changes: 8 additions & 0 deletions web/assets/games.css → web/assets/styles/games.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.games {
.title {
color: #cdd6f4;
margin-left: 10px;
}
.subtitle {
color: #bac2de;
margin-left: 10px;
}

.games-list {
Expand Down Expand Up @@ -85,4 +87,10 @@
}
}
}

@media screen and (max-width: 768px) {
.games-list {
width: 100vw;
}
}
}
File renamed without changes.
6 changes: 6 additions & 0 deletions web/assets/main.css → web/assets/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ main {
margin-left: auto !important;
margin-right: auto !important;
}

@media screen and (max-width: 768px) {
.div-to-align-the-layout {
display: none;
}
}
8 changes: 8 additions & 0 deletions web/assets/projects.css → web/assets/styles/projects.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
.projects {
.title {
color: #cdd6f4;
margin-left: 10px;
}
.subtitle {
color: #bac2de;
margin-left: 10px;
}
.project-tags {
color: #bac2de;
Expand Down Expand Up @@ -143,4 +145,10 @@
}
}
}

@media screen and (max-width: 768px) {
.projects-grid {
width: 90vw;
}
}
}
61 changes: 46 additions & 15 deletions web/assets/sidebar.css → web/assets/styles/sidebar.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@
text-align: center;
color: #cdd6f4;

.profile-frame {
margin-left: auto;
margin-right: auto;
align-items: center;
width: 150px;
height: 150px;
border-radius: 50%;
border: 2px dashed #cdd6f4;
animation: spin 20s linear infinite;
img {
width: 150px;
border-radius: 50%;
animation: counterspin 20s linear infinite;
}
}
.social-links {
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -91,6 +76,26 @@
}
}
}
.profile-icon {
display: none;
position: sticky;
}
.profile-frame {
margin-left: auto;
margin-right: auto;
align-items: center;
width: 150px;
height: 150px;
border-radius: 50%;
border: 2px dashed #cdd6f4;
animation: spin 20s linear infinite;
img {
width: 150px;
border-radius: 50%;
animation: counterspin 20s linear infinite;
}
}

@keyframes spin {
100% {
transform: rotateZ(360deg);
Expand All @@ -101,3 +106,29 @@
transform: rotateZ(-360deg);
}
}
@media screen and (max-width: 768px) {
.sidebar {
display: none;
}
.profile-icon {
display: initial;
position: fixed;
right: 20px;
top: 20px;
z-index: 2;

.profile-frame {
width: 75px;
height: 75px;
border: 2px dashed #cdd6f4;
img {
width: 75px;
}
}
}
}
@media screen and (max-width: 300px) {
.profile-icon {
display: none;
}
}
5 changes: 5 additions & 0 deletions web/src/components/sidebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ use dioxus::prelude::*;
#[component]
pub fn SideBar() -> Element {
rsx! {
div { class: "profile-icon",
div { class: "profile-frame",
img { src: "https://avatars.githubusercontent.com/u/80127749?v=4", alt: "Profile Picture"},
}
}
div { class: "sidebar",
div { class: "profile",
div { class: "profile-frame",
Expand Down
2 changes: 1 addition & 1 deletion web/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ pub fn Main() -> Element {
components::sidebar::SideBar {}
div { class: "main-content",
components::projects::Projects {},
components::games::Games {},
components::blog::Blog {},
components::books::Books {},
components::games::Games {},
}
div { class: "div-to-align-the-layout" }
}
Expand Down

0 comments on commit 93ffa9f

Please sign in to comment.