forked from vaibhavsharma420/HacktoberFest2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSort
More file actions
92 lines (74 loc) · 1.94 KB
/
Sort
File metadata and controls
92 lines (74 loc) · 1.94 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import React from "react";
import styled from "styled-components";
import { BsFillGridFill, BsList } from "react-icons/bs";
import { useFilterContext } from "../context/filter_context";
const Sort = () => {
const {grid_view, setGridView, setListView, sorting}= useFilterContext();
return(
<Wrapper className="sort-section">
<div className="sorting-list--grid">
<button
onClick={setGridView}
className={grid_view? 'active sort-btn': 'sort-btn'}>
<BsFillGridFill className="icon"/>
</button>
<button
onClick={setListView}
className={!grid_view? 'active sort-btn': 'sort-btn'} >
<BsList className="icon"/>
</button>
</div>
<div className="product-data">product</div>
<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='highest'>Price(highest)</option>
<option value='a-z'>Price(a-z)</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: black;
color: white;
}
}
.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;