Browse Source

Add login hamburger menu

tags/v0.1.0
Immanuel Onyeka 3 years ago
parent
commit
7cf28470af
7 changed files with 195 additions and 17 deletions
  1. +11
    -2
      public/main.js
  2. +2
    -3
      resources/build.sh
  3. +13
    -6
      resources/js/main.js
  4. +28
    -0
      resources/scss/_vars.scss
  5. +113
    -3
      resources/scss/main.scss
  6. +27
    -2
      resources/views/home.blade.php
  7. +1
    -1
      resources/views/master.blade.php

+ 11
- 2
public/main.js View File

@@ -1,8 +1,17 @@
var cols = document.querySelectorAll(".collapsible button");
var toggle = document.querySelector(".nav-toggle");
var heroText = document.querySelectorAll(".landing-hero h2,.landing-hero p");
toggle.addEventListener("click", function() {
heroText.forEach((item) => {
item.classList.toggle("hidden");
});
document.querySelector("nav form.login").classList.toggle("active");
this.classList.toggle("toggled");
});
var cols = document.getElementsByClassName("collapsible");
var i; var i;
for (i = 0; i < cols.length; i++) { for (i = 0; i < cols.length; i++) {
cols[i].addEventListener("click", function() { cols[i].addEventListener("click", function() {
this.parentElement.classList.toggle("active");
this.classList.toggle("active");
}); });
} }
//# sourceMappingURL=main.js.map //# sourceMappingURL=main.js.map

+ 2
- 3
resources/build.sh View File

@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh


project=$HOME/projects/trendplays
export project=$HOME/projects/trendplays


watch() { watch() {
npx browser-sync start --proxy 'trendplays.test' -w --files $project/resources/views $project/resources/scss & npx browser-sync start --proxy 'trendplays.test' -w --files $project/resources/views $project/resources/scss &
@@ -9,8 +9,7 @@ watch() {
$project/public/main.css & $project/public/main.css &
pid="$pid $!" pid="$pid $!"
trap "kill -TERM $pid" 0 1 2 15 trap "kill -TERM $pid" 0 1 2 15
find $project/resources/js -type f |
entr 'esbuild resources/js/main.js --sourcemap --outdir=public' &
find $project/resources/js -type f | entr -n esbuild --sourcemap --outdir=$project/public $project/resources/js/main.js &
pid="$pid $!" pid="$pid $!"
trap "kill -TERM $pid" 0 1 2 15 trap "kill -TERM $pid" 0 1 2 15
wait wait


+ 13
- 6
resources/js/main.js View File

@@ -1,15 +1,22 @@
var toggle = document.querySelector(".nav-toggle")
var heroText = document.querySelectorAll(".landing-hero h2,.landing-hero p")

toggle.addEventListener("click", function() {
heroText.forEach(item => {
item.classList.toggle("hidden")
})
document.querySelector("nav form.login").classList.toggle("active")
this.classList.toggle("toggled")
// this.src = "/images/close.svg"
})

//FAQ code
var cols = document.getElementsByClassName("collapsible"); var cols = document.getElementsByClassName("collapsible");
var i; var i;


for (i = 0; i < cols.length; i++) { for (i = 0; i < cols.length; i++) {
cols[i].addEventListener("click", function() { cols[i].addEventListener("click", function() {
this.classList.toggle("active"); this.classList.toggle("active");
// var content = this.nextElementSibling;
// if (content.style.display === "block") {
// content.style.display = "none";
// } else {
// content.style.display = "block";
// }
}); });
} }



+ 28
- 0
resources/scss/_vars.scss View File

@@ -49,6 +49,9 @@ $theme-colors: (
background-color: darkenColor($col); background-color: darkenColor($col);
} }
} }

// A linear gradient with the light color at the top left and dark color at
// bottom right, that darkens on hover
@mixin special-button($start, $end) { @mixin special-button($start, $end) {
font-family: "PatuaOne"; font-family: "PatuaOne";
border: none; border: none;
@@ -62,6 +65,7 @@ $theme-colors: (
} }
} }


// A white button with a transparent background that becomes white and orange on hover
@mixin transparent-button { @mixin transparent-button {
text-align: center; text-align: center;
font-size: 20px; font-size: 20px;
@@ -76,6 +80,7 @@ $theme-colors: (
} }
} }


// A button with a white background and specified accent color that reverses on hover
@mixin brand-button($col) { @mixin brand-button($col) {
width: 10em; width: 10em;
height: 2.5em;; height: 2.5em;;
@@ -97,3 +102,26 @@ $theme-colors: (
box-shadow: 7px 10px 8px rgb(156 166 175 / 22%); box-shadow: 7px 10px 8px rgb(156 166 175 / 22%);
transition: transform 0.2s; transition: transform 0.2s;
} }

@mixin hovering2 {
padding: 18px 9px;
border-radius: 4px;
background: white;
box-shadow: rgba(0, 0, 0, 0.25) 0px 54px 55px, rgba(0, 0, 0, 0.12) 0px -12px 30px, rgba(0, 0, 0, 0.12) 0px 4px 6px, rgba(0, 0, 0, 0.17) 0px 12px 13px, rgba(0, 0, 0, 0.09) 0px -3px 5px;
transition: transform 0.2s;
}

@mixin hovering3 {
padding: 18px 9px;
border-radius: 4px;
background: white;
box-shadow: rgba(0, 0, 0, 0.16) 0px 10px 36px 0px, rgba(0, 0, 0, 0.06) 0px 0px 0px 1px;
transition: transform 0.2s;
}
@mixin hovering-light {
padding: 18px 9px;
border-radius: 4px;
background: white;
box-shadow: rgba(0, 0, 0, 0.16) 0px 1px 4px;
transition: transform 0.2s;
}

+ 113
- 3
resources/scss/main.scss View File

@@ -85,11 +85,13 @@ nav h1 {


nav #logo { nav #logo {
margin-right: 50px; margin-right: 50px;
z-index: 2;
} }


nav form { nav form {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
margin-right: 20px;
} }


nav form div { nav form div {
@@ -104,12 +106,36 @@ nav form input,label {
opacity: 0.7; opacity: 0.7;
} }


nav .nav-toggle {
position: absolute;
right: 10px;
top: 5px;
display: none;
height: 40px;
width: 40px;
margin-left: auto;
background: url("/images/hamburger-menu.svg");
background-size: 100%;
background-size: cover;
}

nav .nav-toggle.toggled {
background: url("/images/close.svg");
width: 25px;
height: 25px;
background-size: 100%;
background-size: cover;
top: 10px;
right: 15px;
}

div.landing-hero { div.landing-hero {
top: 0; top: 0;
height: 50em; height: 50em;
background-color: #ff4e00; background-color: #ff4e00;
// background-image: linear-gradient(to right bottom, #ff4e00, #fc6200, #f87200, #f58100, #f18e00, #f19507, #f09c0f, #f0a317, #f3a620, #f6a927, #f8ad2e, #fbb034); // background-image: linear-gradient(to right bottom, #ff4e00, #fc6200, #f87200, #f58100, #f18e00, #f19507, #f09c0f, #f0a317, #f3a620, #f6a927, #f8ad2e, #fbb034);
background-image: linear-gradient(315deg, #ff4e00 0%, #ec9f05 74%); background-image: linear-gradient(315deg, #ff4e00 0%, #ec9f05 74%);
z-index: 0;
} }


div.hero-filter { div.hero-filter {
@@ -159,6 +185,10 @@ form.login {
color: white; color: white;
} }


.cancel-icon {
width: 30px;
}

form.login input { form.login input {
margin-left: 2px; margin-left: 2px;
color: white; color: white;
@@ -356,6 +386,7 @@ section.benefits-info div {
section.faq-info { section.faq-info {
margin-bottom: 6em; margin-bottom: 6em;
margin-top: 3em; margin-top: 3em;
height: 30em;
} }


.faq-info h2 { .faq-info h2 {
@@ -432,29 +463,108 @@ footer a {
} }
} }


.hidden {
display: none;
}

div.toggle-area {
display: none;
overflow: hidden;
height: 0px;
width: 100%;
z-index: 1;
@include vars.hovering3;
// background-color: vars.getColor("light-grey");
margin-bottom: 2em;
position: absolute;
border-radius: 0;
padding: 0;
}


// Make small screens more usable
@media (max-width: 720px) { @media (max-width: 720px) {
nav { display: block; } nav { display: block; }


nav form { nav form {
display: block;
// display: none;
width: 190px; width: 190px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
align-items: center; align-items: center;
margin-top: 5em;
opacity: 0;
transition: transform 0.3s;
transform: translateY(-50px);
}

nav form.active {
display: block;
transform: translateX(0%);
opacity: 1;
// background: white;
// color: black;
} }

nav form div { nav form div {
margin: 10px auto; margin: 10px auto;
} }

nav div label,input { nav div label,input {
display: block; display: block;
} }


nav .nav-toggle {
display: block;
}

div.toggle-area.active {
display: initial;
}

div.toggle-area h1 {
font-size: 1.5rem;
display: inline-block;
color: vars.getColor("brand-orange");
}

div.toggle-area h3 {
text-align: center;
}

div.toggle-area .login {
color: vars.getColor("brand-orange");
display: block;
margin-left: auto;
margin-right: auto;
// margin-top: 1em;
width: 10em;
// top: 40px;
// position: absolute;
}

div.toggle-area .login input {
border: 2px solid black;
border-color: vars.getColor("brand-orange");
color: black;
}

div.toggle-area button {
margin-top: 1em;
width: 6em;
}

div.toggle-area div {
margin-top: 10px;
margin-bottom: 5px;
}

.landing-hero div.hero-filter h2 { .landing-hero div.hero-filter h2 {
top: 30%;
top: 15%;
} }


.landing-hero div.hero-filter p { .landing-hero div.hero-filter p {
top: 45%;
top: 30%;
} }


.landing-hero div.hero-filter .register-btn { .landing-hero div.hero-filter .register-btn {


+ 27
- 2
resources/views/home.blade.php View File

@@ -9,6 +9,26 @@


@section('content') @section('content')
@parent @parent
<main>
<div class="toggle-area">
<a id='logo' href='/'>
<h1>Trendplays</h1>
<img src="/images/arrow-up.svg" height="30px" alt="">
</a>
<h3>Login</h3>
<form class="login" action="">
@csrf
<div>
<label for='sender_email'>Email</label>
<input required type='email' name='sender_email' placeholder=''
spellcheck='false'>
</div>
<div>
<label for='sender_password'>Password</label>
<input required type='password' name='sender_password' placeholder='' spellcheck='false'>
</div>
<button class='login-btn'type="login">Log in</button>
</form></div>
<div class='landing-hero'> <div class='landing-hero'>
<div class='hero-filter'> <div class='hero-filter'>
<h2>The web's #1 content promoter</h2> <h2>The web's #1 content promoter</h2>
@@ -78,11 +98,15 @@
</div> </div>
<div class="info-cards"> <div class="info-cards">
<div class="info-card"><p> <div class="info-card"><p>
Dolor sint maiores soluta culpa voluptatem ea Similique facere perspiciatis in quos suscipit. Atque velit dolor repudiandae nesciunt ullam Blanditiis asperiores eius quos aliquid ex Rem rem quo facilis commodi.
Dolor sint maiores soluta culpa voluptatem ea Similique facere perspiciatis
in quos suscipit. Atque velit dolor repudiandae nesciunt ullam Blanditiis
asperiores eius quos aliquid ex Rem rem quo facilis commodi.
</p> </p>
</div> </div>
<div class="info-card"><p> <div class="info-card"><p>
Elit aliquam velit ad incidunt in porro laborum? Unde eligendi dolores ad iure quia doloremque! Aliquid pariatur autem sed iure ipsam? Et ipsam architecto dolorum sapiente facilis quos Aut quasi</p>
Elit aliquam velit ad incidunt in porro laborum? Unde eligendi dolores ad
iure quia doloremque! Aliquid pariatur autem sed iure ipsam? Et ipsam
architecto dolorum sapiente facilis quos Aut quasi</p>
</div> </div>
<div class="info-card"><p> <div class="info-card"><p>
Ipsum incidunt non illum mollitia omnis! Minima possimus eveniet autem non Ipsum incidunt non illum mollitia omnis! Minima possimus eveniet autem non
@@ -162,6 +186,7 @@
</p></div></div> </p></div></div>
</div> </div>
</section> </section>
</main>
@endsection @endsection


@section('scripts') @section('scripts')


+ 1
- 1
resources/views/master.blade.php View File

@@ -29,8 +29,8 @@ spellcheck='false'>
<input required type='password' name='sender_password' placeholder='' spellcheck='false'> <input required type='password' name='sender_password' placeholder='' spellcheck='false'>
</div> </div>
<button class='login-btn'type="login">Log in</button> <button class='login-btn'type="login">Log in</button>
</form> </form>
<div class="nav-toggle"><div>
@endguest @endguest
<span class="icon-bar"></span> <span class="icon-bar"></span>


Loading…
Cancel
Save