From b2104b8f697daa96ee6e83cab3a87ae5fd70a5f8 Mon Sep 17 00:00:00 2001 From: ajuvercr Date: Sun, 13 Sep 2020 11:59:34 +0200 Subject: [PATCH] make navbar mobile friendly --- content/assets/navbar_icons/FAQ.svg | 1 + content/assets/navbar_icons/Ontdek.svg | 1 + content/assets/navbar_icons/Quiz.svg | 1 + content/assets/navbar_icons/search.svg | 1 + content/stylesheets/main.css | 79 +++++++++++++++++++++----- layouts/partials/navbar.erb | 11 ++-- 6 files changed, 77 insertions(+), 17 deletions(-) create mode 100644 content/assets/navbar_icons/FAQ.svg create mode 100644 content/assets/navbar_icons/Ontdek.svg create mode 100644 content/assets/navbar_icons/Quiz.svg create mode 100644 content/assets/navbar_icons/search.svg diff --git a/content/assets/navbar_icons/FAQ.svg b/content/assets/navbar_icons/FAQ.svg new file mode 100644 index 0000000..2a3a5c6 --- /dev/null +++ b/content/assets/navbar_icons/FAQ.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/content/assets/navbar_icons/Ontdek.svg b/content/assets/navbar_icons/Ontdek.svg new file mode 100644 index 0000000..5723dc7 --- /dev/null +++ b/content/assets/navbar_icons/Ontdek.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/content/assets/navbar_icons/Quiz.svg b/content/assets/navbar_icons/Quiz.svg new file mode 100644 index 0000000..cb4dc56 --- /dev/null +++ b/content/assets/navbar_icons/Quiz.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/content/assets/navbar_icons/search.svg b/content/assets/navbar_icons/search.svg new file mode 100644 index 0000000..f41bbdd --- /dev/null +++ b/content/assets/navbar_icons/search.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/content/stylesheets/main.css b/content/stylesheets/main.css index 95956de..0f6d107 100644 --- a/content/stylesheets/main.css +++ b/content/stylesheets/main.css @@ -34,8 +34,6 @@ main { justify-content: space-between; width: calc(100%-5rem); - min-height: 100%; - padding: 2rem 2rem 0 2rem; } @@ -84,14 +82,6 @@ footer { margin-top: auto; } -.navbar:hover { - width: 16rem; -} - -.navbar:hover .link-text { - display: block; -} - .nav-link { width: 100%; display: flex; @@ -99,11 +89,12 @@ footer { height: 5rem; color: var(--yellow); text-decoration: none; - transition: 0.2s; + transition: 0.4s; + padding-right: 0.5rem; } -.nav-link__logo { - justify-content: center; +.nav-link a { + color: inherit; } .nav-link:hover { @@ -140,6 +131,68 @@ footer { outline: none; } +/* Small screens */ +@media only screen and (max-width: 600px) { + .navbar { + bottom: 0; + width: 100vw; + height: 5rem; + padding: 0; + } + + .navbar-nav { + flex-direction: row; + } + + .nav-link { + justify-content: center; + } + + main { + margin: 0; + width: 100%; + + padding: 0.5rem; + } +} + +/* Large screens */ +@media only screen and (min-width: 600px) { + .navbar { + top: 0; + width: 5rem; + height: 100vh; + } + + .nav-link__logo { + justify-content: center; + transform: rotate(-90deg); + transition: 0.4s; + } + + .navbar:hover, + .navbar:focus, + .navbar:focus-within { + width: 16rem; + } + + .navbar:hover .link-text, + .navbar:focus .link-text, + .navbar:focus-within .link-text { + display: block; + } + + .navbar:hover .nav-link__logo, + .navbar:focus .nav-link__logo, + .navbar:focus-within .nav-link__logo { + transform: rotate(0deg); + } + + main { + min-height: 100%; + } +} + form { padding: 0; } diff --git a/layouts/partials/navbar.erb b/layouts/partials/navbar.erb index e99e145..4384048 100644 --- a/layouts/partials/navbar.erb +++ b/layouts/partials/navbar.erb @@ -9,16 +9,19 @@ <% for i in navigables %> <% end %>