-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSort.js
More file actions
73 lines (69 loc) · 1.87 KB
/
Copy pathSort.js
File metadata and controls
73 lines (69 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import React from "react";
import styled from "styled-components";
import { useFilterContext } from "../context/filter_context";
const Sort = () => {
const { filter_products, sorting } =
useFilterContext();
return (
<Wrapper className="sort-section">
{/* 1st column */}
<div className="product-data">
<p>{`${filter_products.length} Products Available`}</p>
</div>
{/* 2nd column */}
<div className="sort-selection">
<form action="#">
<label htmlFor="sort"></label>
<select
name="sort"
id="sort"
className="sort-selection--style"
onClick={sorting}>
<option value="lowest">Price(lowest)</option>
<option value="#" disabled></option>
<option value="highest">Price(highest)</option>
<option value="#" disabled></option>
<option value="a-z">Price(a-z)</option>
<option value="#" disabled></option>
<option value="z-a">Price(z-a)</option>
</select>
</form>
</div>
</Wrapper>
);
};
const Wrapper = styled.section`
display: flex;
justify-content: space-between;
margin-top: 5rem;
.sorting-list--grid {
display: flex;
gap: 2rem;
.sort-btn {
padding: 0.8rem 1rem;
border: none;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
.icon {
font-size: 1.6rem;
}
.active {
background-color: ${({ theme }) => theme.colors.black};
color: #fff;
}
}
.sort-selection .sort-selection--style {
padding: 0.5rem;
cursor: pointer;
.sort-select--option {
padding: 0.5rem 0;
cursor: pointer;
height: 2rem;
padding: 10px;
}
}
`;
export default Sort;