diff --git a/src/components/GradeFilter/index.tsx b/src/components/GradeFilter/index.tsx index 336408b..aa4d721 100644 --- a/src/components/GradeFilter/index.tsx +++ b/src/components/GradeFilter/index.tsx @@ -1,28 +1,31 @@ import React, { useState, useEffect } from "react"; +import { connect } from "react-redux"; +import { book } from "../../redux/actions"; import "./index.scss"; import dropdown from "../../assets/icons/dropdown.png"; -export default function GradeFilter(props: any) { +function GradeFilter({selectedGrade, gradeFilter, grades}: any) { const [arrowTop, setArrowTop] = useState(false); - const { grades, grade, setGrade } = props; useEffect(() => { setArrowTop(false); - },[grade]) + }, [selectedGrade]); return (

پایه تحصیلی - {window.innerWidth > 1007 ? : null} +

setArrowTop(!arrowTop)} > - { - grade ?

{grade}

: پایه تحصیلی خود را انتخاب نمائید - } + {selectedGrade ? ( +

{grades[selectedGrade - 1].name}

+ ) : ( + پایه تحصیلی خود را انتخاب نمائید + )} {arrowTop ? ( ) : null} - {window.innerWidth > 1007 ? ( - - ) : null} +
); } + +export default connect( + (state: any) => ({ + selectedGrade: state.book.selectedGrade, + }), + { gradeFilter: book.gradeFilter } +)(GradeFilter); diff --git a/src/components/HomeSearchBox/index.scss b/src/components/HomeSearchBox/index.scss index a1be7fa..36d0f7c 100644 --- a/src/components/HomeSearchBox/index.scss +++ b/src/components/HomeSearchBox/index.scss @@ -103,6 +103,9 @@ &__voice { display: none; } + &__searchIcon{ + display: none; + } form { width: 85%; input { @@ -147,7 +150,8 @@ &__searchIcon { position: absolute; left: 62px; - top: 9px; + top: 50%; + transform: translateY(-50%); width: 27px; } form { diff --git a/src/components/HomeSearchBox/index.tsx b/src/components/HomeSearchBox/index.tsx index bd35dce..bd37704 100644 --- a/src/components/HomeSearchBox/index.tsx +++ b/src/components/HomeSearchBox/index.tsx @@ -1,25 +1,48 @@ import React, { useState } from "react"; import "./index.scss"; +import { connect } from "react-redux"; +import { book } from "../../redux/actions"; import search from "../../assets/icons/search.png"; import voice from "../../assets/icons/voice.png"; -export default function HomeSearchBox(props: any) { - const { lastItems, setVocal, inputValue, setInputValue } = props; +function HomeSearchBox({ + lastItems, + setVocal, + inputValue, + setInputValue, + sortFilter, + selectedSort, +}: any) { + const submitInput = (value: any) => { + setInputValue(value); + sortFilter({ search: value, sort: selectedSort }); + }; + + const submitSort = (value: any) => { + sortFilter({ search: inputValue, sort: value }); + }; return (
e.preventDefault()}> setInputValue(e.target.value)} + onChange={(e) => submitInput(e.target.value)} value={inputValue} /> - - {window.innerWidth < 640 ? ( - - ) : null} + + sortFilter({ search: inputValue, sort: selectedSort })} + /> + @@ -36,7 +36,9 @@ function Subscription({subscribes, selectedSubscribe} : any) { ); } -export default connect((state : any) => ({ - subscribes : state.publicApi.mockSubscribes, - selectedSubscribe : state.publicApi.selectedSubscribe -}), {})(Subscription); +export default connect( + (state: any) => ({ + listVOD: state.product.listVOD, + }), + { getList: product.listVOD } +)(Subscription);