-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Users should be able to search (#13)
* Reusable Components * [Derivers#18758479] ft-user-search * [Derivers#18758479] ft-user-search * user search product UI * user search products * user-search-products * resolving bugs --------- Co-authored-by: Fabrice-Dush <[email protected]> Co-authored-by: Aime-Patrick <[email protected]>
- Loading branch information
1 parent
144a4e9
commit 6426745
Showing
16 changed files
with
705 additions
and
119 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
.custom-select-wrapper { | ||
position: relative; | ||
width: 20rem; | ||
.custom-select { | ||
cursor: pointer; | ||
} | ||
.select-selected { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
padding: 10px; | ||
border: 1px solid #ccc; | ||
border-radius: 4px; | ||
border: 1px solid rgba(255, 109, 24, 0.49); | ||
background-color: #fff; | ||
} | ||
.dropdown-icon { | ||
font-size: 24px; | ||
} | ||
.select-items { | ||
position: absolute; | ||
width: 100%; | ||
max-height: 10rem; | ||
overflow-y: auto; | ||
border: 1px solid #ccc; | ||
border-top: none; | ||
background-color: #fff; | ||
z-index: 1; | ||
} | ||
.select-option { | ||
padding: 10px; | ||
cursor: pointer; | ||
} | ||
.select-option:hover { | ||
background-color: #f1f1f1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
.wrappers { | ||
background-color: $container-color; | ||
|
||
.upper-side { | ||
display: flex; | ||
align-items: center; | ||
font-size: 1.5rem; | ||
padding: 2rem 5rem; | ||
border-bottom: 2px solid rgba(119, 119, 119, 0.49); | ||
|
||
.product-name { | ||
font-size: 2rem; | ||
font-weight: 700; | ||
color: $text-color; | ||
margin-right: 2rem; | ||
} | ||
|
||
.filter-option { | ||
display: flex; | ||
gap: 10rem; | ||
|
||
.selection-part { | ||
display: flex; | ||
align-items: center; | ||
gap: 2rem; | ||
font-size: 2rem; | ||
font-weight: 700; | ||
color: $text-color; | ||
|
||
} | ||
|
||
.search-Span-price { | ||
font-size: 2rem; | ||
font-weight: 700; | ||
color: $text-color; | ||
margin-right: 2rem; | ||
} | ||
|
||
.dropdown-select { | ||
|
||
gap: 2rem; | ||
font-size: 2rem; | ||
font-weight: 700; | ||
color: $text-color; | ||
border: 1px solid rgba(255, 109, 24, 0.49); | ||
border-radius: 4px; | ||
padding: 0.5rem 2rem; | ||
font-size: 15px; | ||
cursor: pointer; | ||
} | ||
} | ||
|
||
.discount-display { | ||
font-size: 2rem; | ||
display: flex; | ||
align-items: center; | ||
} | ||
} | ||
|
||
.product-main { | ||
display: flex; | ||
|
||
.product-list { | ||
display: flex; | ||
flex-wrap: wrap; | ||
margin: 3rem 3rem; | ||
margin-left: 5rem; | ||
gap: 3rem; | ||
} | ||
|
||
.loader-spinner { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
margin-left: 70rem; | ||
margin-top: 20rem; | ||
} | ||
|
||
.noResult { | ||
margin: 0 auto; | ||
display: flex; | ||
flex-direction: column; | ||
margin-bottom: 1rem; | ||
|
||
img { | ||
width: auto; | ||
height: 400px; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,89 @@ | ||
@import "./Colors"; | ||
|
||
.search-container { | ||
display: flex; | ||
align-items: center; | ||
border: 0.1rem solid $primary-color-dark; | ||
border-radius: 10rem; | ||
overflow: hidden; | ||
|
||
.main-search { | ||
gap:2rem; | ||
position: relative; | ||
|
||
.search-icon { | ||
font-size: 2.4rem; | ||
margin-left: -2rem; | ||
.search-container { | ||
display: flex; | ||
color: $primary-color; | ||
align-items: center; | ||
justify-content: center; | ||
position: relative; | ||
cursor: pointer; | ||
z-index: 1; | ||
} | ||
border: 0.1rem solid $primary-color-dark; | ||
border-radius: 10rem; | ||
overflow: hidden; | ||
|
||
input { | ||
border: none; | ||
outline: none; | ||
font-family: inherit; | ||
font-size: 1.6rem; | ||
flex: 1; | ||
background-color: transparent; | ||
|
||
&::placeholder { | ||
color: $secondary-color; | ||
.search-icon { | ||
font-size: 2.4rem; | ||
padding-left:1rem; | ||
display: flex; | ||
color: $primary-color; | ||
align-items: center; | ||
justify-content: center; | ||
position: relative; | ||
cursor: pointer; | ||
z-index: 1; | ||
} | ||
} | ||
|
||
.search-button { | ||
background-color: $primary-color; | ||
border: none; | ||
padding: 0.8rem 4.8rem; | ||
color: $white; | ||
font-size: 1.6rem; | ||
font-weight: 600; | ||
cursor: pointer; | ||
position: relative; | ||
z-index: 1; | ||
transition: all 0.2s ease-in; | ||
|
||
&:hover { | ||
background-color: darken($primary-color, 10%); | ||
input { | ||
border: none; | ||
outline: none; | ||
font-family: inherit; | ||
font-size: 1.6rem; | ||
flex: 1; | ||
background-color: transparent; | ||
|
||
&::placeholder { | ||
color: $secondary-color; | ||
} | ||
} | ||
|
||
&:focus { | ||
outline: none; | ||
.search-button { | ||
background-color: $primary-color; | ||
border: none; | ||
padding: 0.8rem 4.8rem; | ||
color: $white; | ||
font-size: 1.6rem; | ||
font-weight: 600; | ||
cursor: pointer; | ||
position: relative; | ||
z-index: 1; | ||
transition: all 0.2s ease-in; | ||
|
||
&:hover { | ||
background-color: darken($primary-color, 10%); | ||
} | ||
|
||
&:focus { | ||
outline: none; | ||
} | ||
} | ||
} | ||
.search-result { | ||
position: absolute; | ||
width: 36.5rem; | ||
max-height: 28em; | ||
left: 0.5rem; | ||
z-index: 1000; | ||
margin-top: 0.1rem; | ||
padding: 1rem; | ||
font-size: 14px; | ||
font-weight: 500; | ||
background-color: $white; | ||
overflow-y: auto; | ||
text-decoration: none; | ||
.result { | ||
display: flex; | ||
flex-direction: column; | ||
padding: 13px; | ||
border: 1px solid none; | ||
margin-top: 1px; | ||
} | ||
.result:hover { | ||
background: rgb(242, 240, 240); | ||
padding: 15px; | ||
cursor: pointer; | ||
} | ||
} | ||
.link{ | ||
text-decoration: none; | ||
color: black; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* eslint-disable */ | ||
import React, { useState, useEffect, useRef } from 'react'; | ||
import { RiArrowDropDownLine } from 'react-icons/ri'; | ||
|
||
interface Option { | ||
label: string; | ||
value: string; | ||
} | ||
|
||
interface CustomSelectProps { | ||
options: Option[]; | ||
onSelect: (selected: string) => void; | ||
value: string; | ||
} | ||
|
||
const CustomSelect: React.FC<CustomSelectProps> = ({ options, onSelect, value }) => { | ||
const [selectedLabel, setSelectedLabel] = useState('Select an option'); | ||
const [isOpen, setIsOpen] = useState(false); | ||
const wrapperRef = useRef<HTMLDivElement>(null); | ||
|
||
useEffect(() => { | ||
const selectedOption = options.find(option => option.value === value); | ||
if (selectedOption) { | ||
setSelectedLabel(selectedOption.label); | ||
} | ||
}, [value, options]); | ||
|
||
useEffect(() => { | ||
const handleClickOutside = (event: MouseEvent) => { | ||
if (wrapperRef.current && !wrapperRef.current.contains(event.target as Node)) { | ||
setIsOpen(false); | ||
} | ||
}; | ||
document.addEventListener('mousedown', handleClickOutside); | ||
return () => { | ||
document.removeEventListener('mousedown', handleClickOutside); | ||
}; | ||
}, []); | ||
|
||
const handleOptionClick = (option: Option) => { | ||
setSelectedLabel(option.label); | ||
setIsOpen(false); | ||
onSelect(option.value); | ||
}; | ||
|
||
return ( | ||
<div className="custom-select-wrapper" ref={wrapperRef}> | ||
<div className="custom-select" onClick={() => setIsOpen(!isOpen)}> | ||
<div className="select-selected"> | ||
{selectedLabel} | ||
<RiArrowDropDownLine className="dropdown-icon" /> | ||
</div> | ||
{isOpen && ( | ||
<div className="select-items"> | ||
{options.map((option, index) => ( | ||
<div | ||
key={index} | ||
className="select-option" | ||
onClick={() => handleOptionClick(option)} | ||
> | ||
{option.label} | ||
</div> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CustomSelect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* eslint-disable */ | ||
|
||
import React from "react"; | ||
|
||
const Button = ({ title }: { title: string }) => ( | ||
<button type="button">{title}</button> | ||
); | ||
|
||
export default Button; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.