|
|
|
@ -4,18 +4,28 @@ import { Link } from "react-router-dom"; |
|
|
|
|
|
|
|
|
|
const Pages = [ |
|
|
|
|
{ |
|
|
|
|
strings : 'خانه - home - Home - Landing - landing', link : '/', name : 'خانه' |
|
|
|
|
strings: "خانه - home - Home - Landing - landing", |
|
|
|
|
link: "/", |
|
|
|
|
name: "خانه", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
strings : 'ورود - ثبت نام - لاگین - login - Login', link : '/signup', name : 'ورود یا ثبت نام' |
|
|
|
|
strings: "ورود - ثبت نام - لاگین - login - Login", |
|
|
|
|
link: "/signup", |
|
|
|
|
name: "ورود یا ثبت نام", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
strings : 'کتاب - محصول - ویدئو - book - video - books - videos - خرید - ریاضی - علوم - شیمی - زیست - محصولات - ویدئوها - کتابها', link : '/products', name : 'محصولات' |
|
|
|
|
strings: |
|
|
|
|
"کتاب - محصول - ویدئو - book - video - books - videos - خرید - ریاضی - علوم - شیمی - زیست - محصولات - ویدئوها - کتابها", |
|
|
|
|
link: "/products", |
|
|
|
|
name: "محصولات", |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
strings : 'آدرس - شماره تماس - ارتباط با ما - نقشه - تیکت - شکایت - address - map - phone number - contact us', link : '/contact-us', name : 'ارتباط با ما' |
|
|
|
|
strings: |
|
|
|
|
"آدرس - شماره تماس - ارتباط با ما - نقشه - تیکت - شکایت - address - map - phone number - contact us", |
|
|
|
|
link: "/contact-us", |
|
|
|
|
name: "ارتباط با ما", |
|
|
|
|
}, |
|
|
|
|
] |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
export const SearchResult = ({ text, books, setText }) => { |
|
|
|
|
const [relatedBooks, setRelatedBooks] = useState([]); |
|
|
|
@ -31,22 +41,20 @@ export const SearchResult = ({ text, books, setText }) => { |
|
|
|
|
let pages = Pages.filter((page) => page.strings.indexOf(text) !== -1); |
|
|
|
|
setRelatedPages(pages); |
|
|
|
|
setRelatedBooks(list); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, [text]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div |
|
|
|
|
className="w-full list-none relative z-50" |
|
|
|
|
> |
|
|
|
|
<div className="w-full list-none relative z-50"> |
|
|
|
|
<div |
|
|
|
|
onClick={(e) => e.stopPropagation()} |
|
|
|
|
className="absolute -top-1 w-full left-0 px-6 pt-5 bg-white pb-5 shadow-lg rounded-md flex flex-col overflow-y-scroll z-50" |
|
|
|
|
style={{ maxHeight: "calc(100vh / 1.5)", direction : 'ltr' }} |
|
|
|
|
style={{ maxHeight: "calc(100vh / 1.5)", direction: "ltr" }} |
|
|
|
|
> |
|
|
|
|
<header className="w-full flex flex-row-reverse items-center gap-4"> |
|
|
|
|
<strong className="text-greenBA font-normal text-sm">محصولات</strong> |
|
|
|
|
<strong className="text-greenBA font-normal text-sm"> |
|
|
|
|
{window.t("محصولات")}{" "} |
|
|
|
|
</strong> |
|
|
|
|
<span |
|
|
|
|
className="flex-1 bg-greenBA bg-opacity-30" |
|
|
|
|
style={{ height: 1 }} |
|
|
|
@ -76,9 +84,18 @@ export const SearchResult = ({ text, books, setText }) => { |
|
|
|
|
</Link> |
|
|
|
|
))} |
|
|
|
|
</ul> |
|
|
|
|
) : <span style={{direction: "rtl"}} className="text-blueC0 text-sm text-right py-4 font-semibold">هیچ محصولی یافت نشد.</span>} |
|
|
|
|
) : ( |
|
|
|
|
<span |
|
|
|
|
style={{ direction: "rtl" }} |
|
|
|
|
className="text-blueC0 text-sm text-right py-4 font-semibold" |
|
|
|
|
> |
|
|
|
|
{window.t("هیچ محصولی یافت نشد.")} |
|
|
|
|
</span> |
|
|
|
|
)} |
|
|
|
|
<header className="w-full flex flex-row-reverse items-center gap-4 mt-5"> |
|
|
|
|
<strong className="text-greenBA font-normal text-sm">صفحات</strong> |
|
|
|
|
<strong className="text-greenBA font-normal text-sm"> |
|
|
|
|
{window.t("صفحات")} |
|
|
|
|
</strong> |
|
|
|
|
<span |
|
|
|
|
className="flex-1 bg-greenBA bg-opacity-30" |
|
|
|
|
style={{ height: 1 }} |
|
|
|
@ -97,7 +114,14 @@ export const SearchResult = ({ text, books, setText }) => { |
|
|
|
|
</Link> |
|
|
|
|
))} |
|
|
|
|
</ul> |
|
|
|
|
) : <span style={{direction: "rtl"}} className="text-blueC0 text-sm text-right py-4 font-semibold">هیچ صفحه ای موجود نیست</span>} |
|
|
|
|
) : ( |
|
|
|
|
<span |
|
|
|
|
style={{ direction: "rtl" }} |
|
|
|
|
className="text-blueC0 text-sm text-right py-4 font-semibold" |
|
|
|
|
> |
|
|
|
|
{window.t("هیچ صفحه ای موجود نیست")} |
|
|
|
|
</span> |
|
|
|
|
)} |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
); |
|
|
|
|