Skip to content

Commit

Permalink
feat: improve search styles
Browse files Browse the repository at this point in the history
  • Loading branch information
andyesp committed Oct 12, 2023
1 parent 78341dd commit 04e6e26
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 18 deletions.
6 changes: 5 additions & 1 deletion src/components/Layout/Navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
}

@media (max-width: 767px) {
.Navigation .dcl.tabs {
padding-right: 32px;
}

.Navigation .dcl.tabs-left {
width: 100%;
overflow: scroll;
Expand All @@ -39,7 +43,7 @@
white-space: nowrap;
}

.dcl.tabs .ui.container {
.Navigation .dcl.tabs .ui.container {
display: flex;
}

Expand Down
20 changes: 15 additions & 5 deletions src/components/Search/SearchInputMobile.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,35 @@
justify-content: center;
background: var(--white-900);
width: 40px;
height: 34px;
height: 35px;
gap: 8px;
font-size: 16px;
/* transition: all 0.5s ease-in-out; */
}

.SearchInputMobile--open {
width: 100%;
padding: 0 16px;
height: 34px;
padding-left: 16px;
padding-right: 10px;
top: 0;
}

/* background: linear-gradient(270deg, #FFF 0%, rgba(255, 255, 255, 0.00) 103.13%); */
.SearchInputMobile__Gradient {
width: 16px;
height: 34.5px;
position: absolute;
left: -16px;
background: linear-gradient(270deg, #fff 0%, rgba(255, 255, 255, 0) 103.13%);
flex-shrink: 0;
}

.SearchInputMobile__Input {
width: 16px;
padding: 8px 13px;
border: 0;
background: var(--white-900) no-repeat 8px center;
background-image: url('../../images/icons/new-magnify.svg');
outline-width: 0;
outline: none;
}

.SearchInputMobile__Input--open {
Expand All @@ -45,6 +53,8 @@
}

.SearchInputMobile__Container {
display: flex;
flex-direction: row;
position: relative;
width: 100%;
}
17 changes: 5 additions & 12 deletions src/components/Search/SearchInputMobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ export default function SearchInputMobile() {
const [searchText, setSearchText] = useState(() => search || '')

const focusSearch = () => {
setTimeout(() => {
searchInput.current?.focus()
searchInput.current?.click()
}, 500)
searchInput.current?.focus()
searchInput.current?.click()
}

useEffect(() => {
Expand All @@ -48,7 +46,7 @@ export default function SearchInputMobile() {
}
}, [search])

const handleChange = (e: React.ChangeEvent<any>) => {
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setSearchText(e.target.value)
}

Expand All @@ -73,16 +71,10 @@ export default function SearchInputMobile() {
}
}

const handleOpen = () => {
if (!open) {
setOpen(true)
focusSearch()
}
}

return (
<div className={classNames('SearchInputMobile', open && 'SearchInputMobile--open')}>
<div className="SearchInputMobile__Container">
<div className="SearchInputMobile__Gradient" />
<input
className={classNames('SearchInputMobile__Input', open && 'SearchInputMobile__Input--open')}
value={searchText}
Expand All @@ -98,6 +90,7 @@ export default function SearchInputMobile() {
<Cross className="SearchInputMobile__CloseIcon" size="14" color="var(--black-800)" onClick={handleClear} />
)}
</div>
<div className={classNames('SearchInputMobile__Overlay', open && 'SearchInputMobile__Overlay--open')} />
</div>
)
}

0 comments on commit 04e6e26

Please sign in to comment.