Skip to content

Commit

Permalink
add search details
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown committed Mar 17, 2019
1 parent c3cc682 commit f262306
Show file tree
Hide file tree
Showing 7 changed files with 262 additions and 22 deletions.
50 changes: 50 additions & 0 deletions css/multirange.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@supports (--css: variables) {
input[type="range"].multirange {
padding: 0;
margin: 5px;
display: inline-block;
vertical-align: top;
-webkit-appearance: none;
background-color: transparent;
}
input[type="range"].multirange.original {
position: absolute;
}
input[type="range"].multirange.original::-webkit-slider-thumb {
position: relative;
z-index: 2;
}
input[type="range"].multirange.original::-moz-range-thumb {
transform: scale(1);
/* FF doesn't apply position it seems */
z-index: 1;
}
input[type="range"].multirange::-moz-range-track {
border-color: transparent;
/* needed to switch FF to "styleable" control */
}
input[type="range"].multirange.ghost {
position: relative;
background: var(--track-background);
--track-background: linear-gradient(to right, rgb(189, 193, 199) var(--low), var(--range-color) 0, var(--range-color) var(--high), rgb(189, 193, 199) 0) no-repeat 0 45% / 100% 20%;
--range-color: #bc9352;
width: 300px;
}
input[type="range"].multirange.ghost::-webkit-slider-runnable-track {
background: var(--track-background);
}
input[type="range"].multirange.ghost::-moz-range-track {
background: var(--track-background);
}
input[type="range"].multirange::-webkit-slider-thumb {
pointer-events: all;
position: relative;
z-index: 1;
outline: 0;
-webkit-appearance: none;
border: none;
width: 28px;
height: 11px;
background-image: url(../images/price-range.png)/* W3C */
}
}
51 changes: 44 additions & 7 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.hero__btn, .details-btn {
.hero__btn, .details-btn, .search__btn, .search__detailed {
font-size: 13px;
background: none;
border: none;
Expand All @@ -15,7 +15,7 @@
text-decoration: none; }

body {
background-image: url(../images/BGimage.png);
background-image: url(../images/BGimage1.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
Expand Down Expand Up @@ -171,23 +171,60 @@ nav {
background: linear-gradient(90deg, #bc9352 0%, #c19857 25%, #d1a866 100%); }

.search {
width: 1000px;
height: 100px;
display: flex;
font-size: 13px;
color: #bdc1c7;
padding: 28px 43px;
align-items: center;
justify-content: space-between; }
justify-content: space-between;
background-color: rgba(47, 62, 84, 0.7); }
.search__wrap {
height: 40px;
width: 240px;
overflow: hidden;
border: 1px solid white;
background: url(../images/icon/select-arrow.svg) 96%/20% no-repeat; }
border: 1px solid #515e70;
background: url(../images/icon/select-arrow.svg);
background-repeat: no-repeat;
background-position: 96% 45%; }
.search__name {
height: 40px;
width: 270px;
background: transparent;
color: white; }
color: #bdc1c7;
padding-left: 12px;
border: none; }
.search__charact {
background-color: transparent;
width: 90px;
height: 40px;
border: none;
text-align: right; }
.search__charact-wrap {
border: 1px solid #515e70;
height: 40px;
width: 135px;
display: flex; }
.search__btn {
background-image: url(../images/icon/search.png);
background-repeat: no-repeat;
background-position: center;
width: 45px; }
.search__detailed {
background-color: transparent;
color: #bdc1c7; }
.search__currency {
float: left; }
.search__price {
width: 300px; }
.search__rangePrice {
display: block;
text-align: right; }

option {
width: 240px;
background-color: #2d3b50;
color: #bdc1c7; }

@media only screen and (max-width: 992px) {
.mycontainer {
Expand Down
Binary file added images/price-range.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 19 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<title>Fan Time</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Playfair+Display:400,700,900" rel="stylesheet">
<link rel="stylesheet" href="css/multirange.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>

Expand All @@ -20,13 +20,13 @@
<div class="logo">
<img src="./images/logo.png" alt="Yacht Marine">
</div>
<nav class="navbar navbar-expand-lg navbar-dark p-o">
<nav class="navbar navbar-expand-lg navbar-dark p-0">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse flex-column " id="navbarSupportedContent">
<div class="header__top-wrapper p-0">
<div class="header__top mycontainer ">
<div class="header__top mycontainer p-0">
<div class="contacts left ">
<a href="tel:+9965553453 " class="header__link "><img src="./images/icon/fa-mobile-phone.svg " alt="phone number " class="header__icon ">996 - 5553 - 453</a>
<a href="mailto:info@shopy.com " class="header__link isbefore"> <img src="./images/icon/fa-envelope.svg " alt="email " class="header__icon isbefore">info@shopy.com</a>
Expand Down Expand Up @@ -93,15 +93,27 @@ <h1 class="hero__title">Luxury crewed catamaran fllet</h1>
<option>name3</option>
</select>
</div>
</div>
<button type="button" class="hero__btn">Scroll Down &nbsp;&nbsp;<img src="./images/icon/fa-long-arrow-up.svg" alt="arrow down"></button>
<div class="search__price">
<div class="search__currency">
PRICE<span class="funt">£</span> /<span class="funt"></span></span> / <span class="funt"></span>$</span>
</div>
<span class="search__rangePrice rangePrice">0 M - 200 M</span>
<input type="range" multiple value="10,200" step="1" max="200" min="0">
</div>
<div class="search__charact-wrap">
<input type="search" placeholder="SEARCH" class="search__charact">
<button type="button" class="search__btn"></button>
</div>
<div>
<button type="button" class="search__detailed">DETAILED SEARCH &nbsp;&nbsp;<img src="./images/icon/Shape 1.svg"></button>
</div>
<button type="button" class="hero__btn">Scroll Down &nbsp;&nbsp;<img src="./images/icon/fa-long-arrow-up.svg" alt="arrow down"></button>
</section>
<!-- Optional JavaScript -->

<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="multirange.js"></script>
<script src="script.js "></script>

</body>
Expand Down
91 changes: 91 additions & 0 deletions multirange.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
(function() {
"use strict";

var supportsMultiple = self.HTMLInputElement && "valueLow" in HTMLInputElement.prototype;

var descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value");
let price = document.querySelector(".rangePrice");
var multirange = function(input) {
if (supportsMultiple || input.classList.contains("multirange")) {
return;
}

var value = input.getAttribute("value");
var values = value === null ? [] : value.split(",");
var min = +(input.min || 0);
var max = +(input.max || 300);
var ghost = input.cloneNode();

input.classList.add("multirange", "original");
ghost.classList.add("multirange", "ghost");

input.value = values[0] || min + (max - min) / 2;
ghost.value = values[1] || min + (max - min) / 2;

input.parentNode.insertBefore(ghost, input.nextSibling);

Object.defineProperty(input, "originalValue", descriptor.get ? descriptor : {
// Fuck you Safari >:(
get: function() { return this.value; },
set: function(v) { this.value = v; }
});

Object.defineProperties(input, {
valueLow: {
get: function() { return Math.min(this.originalValue, ghost.value); },
set: function(v) { this.originalValue = v; },
enumerable: true
},
valueHigh: {
get: function() { return Math.max(this.originalValue, ghost.value); },
set: function(v) { ghost.value = v; },
enumerable: true
}
});

if (descriptor.get) {
// Again, fuck you Safari
Object.defineProperty(input, "value", {
get: function() { return this.valueLow + "," + this.valueHigh; },
set: function(v) {
var values = v.split(",");
this.valueLow = values[0];
this.valueHigh = values[1];
update();
},
enumerable: true
});
}

if (typeof input.oninput === "function") {
ghost.oninput = input.oninput.bind(input);
}

function update() {
ghost.style.setProperty("--low", 100 * ((input.valueLow - min) / (max - min)) + 1 + "%");
ghost.style.setProperty("--high", 100 * ((input.valueHigh - min) / (max - min)) - 1 + "%");
price.innerHTML = "$ " + parseFloat(input.value) + "M - $" + parseFloat(ghost.value) + "M";
}

input.addEventListener("input", update);
ghost.addEventListener("input", update);

update();
}

multirange.init = function() {
[].slice.call(document.querySelectorAll("input[type=range][multiple]:not(.multirange)")).forEach(multirange);
}

if (typeof module === "undefined") {
self.multirange = multirange;
if (document.readyState == "loading") {
document.addEventListener("DOMContentLoaded", multirange.init);
} else {
multirange.init();
}
} else {
module.exports = multirange;
}

})();
62 changes: 55 additions & 7 deletions sass/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//variables
$grey-color:rgba(52, 58, 64, 0.8);
$main-color:#2d3b50;
$brand-color: #bc9352;
%button {
font-size: 13px;
Expand All @@ -20,7 +21,7 @@
}

body {
background-image: url(../images/BGimage.png);
background-image: url(../images/BGimage1.png);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
Expand Down Expand Up @@ -75,7 +76,7 @@

.header {
&__top {
background-color: #2d3b50;
background-color: $main-color;
display: flex;
width: 100%;
justify-content: space-between;
Expand Down Expand Up @@ -207,25 +208,72 @@
}

.search {
width: 1000px;
height: 100px;
display: flex;
font-size: 13px;
color: #bdc1c7;
padding: 28px 43px;
align-items: center;
justify-content: space-between;
background-color: rgba(47, 62, 84, 0.7);
&__wrap {
height: 40px;
width: 240px;
overflow: hidden;
border: 1px solid white;
background: url(../images/icon/select-arrow.svg) 96% / 20% no-repeat;
border: 1px solid rgb(81, 94, 112);
background: url(../images/icon/select-arrow.svg);
background-repeat: no-repeat;
background-position: 96% 45%;
}
&__name {
height: 40px;
width: 270px;
background: transparent;
color: white;
color: #bdc1c7;
padding-left: 12px;
border: none
}
&__charact {
background-color: transparent;
width: 90px;
height: 40px;
border: none;
text-align: right;
&-wrap {
border: 1px solid rgb(81, 94, 112);
height: 40px;
width: 135px;
display: flex;
}
}
&__btn {
@extend %button;
background-image: url(../images/icon/search.png);
background-repeat: no-repeat;
background-position: center;
width: 45px;
}
&__detailed {
background-color: transparent;
color: #bdc1c7;
@extend %button;
}
&__currency {
float: left;
}
&__price {
width: 300px;
}
&__rangePrice {
display: block;
text-align: right;
}
}

option {
width: 240px;
background-color: $main-color;
color: #bdc1c7;
}

@media only screen and (max-width: 992px) {
Expand All @@ -234,7 +282,7 @@
}
.navbar {
padding: 0;
background-color: #2d3b50;
background-color: $main-color;
text-align: center;
}
.logo {
Expand Down
Loading

0 comments on commit f262306

Please sign in to comment.