Skip to content

Commit 9322ed4

Browse files
committed
PR adjustment to disable search element and sidebar navigation menu.
1 parent dfa6358 commit 9322ed4

File tree

4 files changed

+36
-14
lines changed

4 files changed

+36
-14
lines changed

src/app/global.css

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:root {
88
--default-primary-color: #386F4F;
99
--default-secondary-color: #F6C367;
10+
--default-tertiary-color: #808080;
1011
--default-bg-color: #EBF1ED;
1112
}
1213

src/components/shared/SearchBar/SearchBar.tsx

+10-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
import './SearchBar.scss';
44

55
import { useTranslations } from 'next-intl';
6-
import { useState, useRef, ChangeEvent, FormEvent } from 'react';
6+
import { useContext, useState, useRef, ChangeEvent, FormEvent } from 'react';
77
import { FormControl, TextField } from '@mui/material';
88
import SearchIcon from '@mui/icons-material/Search';
99
import { fetchSellers } from '@/services/sellerApi';
1010

1111
import logger from '../../../../logger.config.mjs';
12+
import { AppContext } from '../../../../context/AppContextProvider';
1213

1314
interface searchBarProps {
1415
onSearch?: (query: string, results: any[]) => void;
@@ -21,6 +22,8 @@ const SearchBar: React.FC<searchBarProps> = ({ onSearch, page }) => {
2122
const [searchBarValue, setSearchBarValue] = useState('');
2223
const [loading, setLoading] = useState(false);
2324

25+
const { isSigningInUser } = useContext(AppContext);
26+
2427
const inputRef = useRef<HTMLInputElement>(null);
2528

2629
const getPlaceholderText = (page: 'map_center' | 'default'): string => {
@@ -70,17 +73,20 @@ const SearchBar: React.FC<searchBarProps> = ({ onSearch, page }) => {
7073
type="text"
7174
variant="outlined"
7275
color="success"
73-
className="bg-white hover:bg-gray-100 w-full rounded"
74-
label={placeholder}
76+
className={`w-full rounded ${isSigningInUser ? 'bg-gray-200' : 'bg-white hover:bg-gray-100'}`}
77+
label={`${isSigningInUser ? '' : placeholder}`}
7578
value={searchBarValue}
7679
onChange={handleSearchBarChange}
7780
ref={inputRef}
81+
disabled={isSigningInUser}
7882
/>
7983
</FormControl>
8084
<button
8185
aria-label="search"
8286
type="submit"
83-
className="bg-primary rounded h-full w-15 p-[15.5px] flex items-center justify-center hover:bg-gray-600"
87+
className={`rounded h-full w-15 p-[15.5px] flex items-center justify-center
88+
${isSigningInUser ? 'bg-tertiary' : 'bg-primary hover:bg-gray-500'}`}
89+
disabled={isSigningInUser}
8490
>
8591
<SearchIcon className="text-[#ffc153]" />
8692
</button>

src/components/shared/navbar/Navbar.tsx

+24-10
Original file line numberDiff line numberDiff line change
@@ -54,27 +54,41 @@ function Navbar() {
5454
className="flex justify-between">
5555
<div className={`${styles.nav_item} ${checkHomePage && 'disabled'}`}>
5656
<Link href="/" onClick={handleBackBtn}>
57-
<IoMdArrowBack size={26} className={`${checkHomePage ? 'grey' : 'text-secondary'}`} />
57+
<IoMdArrowBack size={26} className={`${checkHomePage ? 'text-tertiary' : 'text-secondary'}`} />
5858
</Link>
5959
</div>
6060

6161
<div className={`${styles.nav_item} ${checkHomePage && 'disabled'}`}>
6262
<Link href="/">
63-
<MdHome size={24} className={`${checkHomePage ? 'grey' : 'text-secondary'}`} />
63+
<MdHome size={24} className={`${checkHomePage ? 'text-tertiary' : 'text-secondary'}`} />
6464
</Link>
6565
</div>
6666
<div className={`${styles.nav_item}`}>
67-
<Link href="" onClick={handleMenu}>
68-
{sidebarToggle ? (
69-
<IoMdClose size={24} className="text-secondary" />
70-
) : (
71-
<FiMenu size={24} className="text-secondary" />
72-
)}
73-
</Link>
67+
<Link
68+
href=""
69+
onClick={(e) => {
70+
if (isSigningInUser) {
71+
e.preventDefault();
72+
} else {
73+
handleMenu();
74+
}
75+
}}
76+
>
77+
{sidebarToggle && !isSigningInUser ? (
78+
<IoMdClose size={24} className="text-secondary" />
79+
) : (
80+
<FiMenu
81+
size={24}
82+
className={`${
83+
isSigningInUser ? 'text-tertiary cursor-not-allowed' : 'text-secondary'
84+
}`}
85+
/>
86+
)}
87+
</Link>
7488
</div>
7589
</div>
7690
</div>
77-
{sidebarToggle && (
91+
{sidebarToggle && !isSigningInUser && (
7892
<Sidebar toggle={sidebarToggle} setToggleDis={setSidebarToggle} />
7993
)}
8094
</>

tailwind.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const config: Config = {
1111
colors: {
1212
primary: 'var(--default-primary-color)',
1313
secondary: 'var(--default-secondary-color)',
14+
tertiary: 'var(--default-tertiary-color)',
1415
background: 'var(--default-bg-color)'
1516
},
1617
height: {

0 commit comments

Comments
 (0)