|
|
|
@ -6,26 +6,51 @@ import Progress from "../../../../../components/Progress"; |
|
|
|
|
import arrowBlueIcon from "../../../../../assets/icons/arrow-right-blue.svg"; |
|
|
|
|
import arrowWhiteIcon from "../../../../../assets/icons/arrow-left-white.svg"; |
|
|
|
|
|
|
|
|
|
function Videos({ list, getList, grades, isDark }) { |
|
|
|
|
function Videos({ list, getList, grades, isDark, isMobile }) { |
|
|
|
|
useEffect(() => { |
|
|
|
|
getList(); |
|
|
|
|
}, []); |
|
|
|
|
|
|
|
|
|
const Book = ({ book }) => { |
|
|
|
|
return ( |
|
|
|
|
<li className="flex flex-col"> |
|
|
|
|
<Link to={"/products/" + book.name}> |
|
|
|
|
<img |
|
|
|
|
src={`https://dnvn.ir/api/v1/file/${book.fileIds}`} |
|
|
|
|
alt="" |
|
|
|
|
className="rounded-sm" |
|
|
|
|
style={{ |
|
|
|
|
height: isMobile ? "calc(100vw / 2 * 2 / 3)" : "calc(100vw / 8 * 2 / 4)", |
|
|
|
|
width: isMobile ? "calc(100vw / 2 )" : "calc(100vw / 8 )", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
<h2 className="mt-2 text-sm font-semibold text-blue5F dark:text-white lg:mt-4 lg:text-tiny"> |
|
|
|
|
{book.name} |
|
|
|
|
</h2> |
|
|
|
|
<p className="font-medium text-blueC0 dark:text-greenBA text-xs mt-1 lg:mt-2 lg:text-sm">{`پایه ${ |
|
|
|
|
grades[book.gradeId] |
|
|
|
|
}`}</p>
|
|
|
|
|
<Progress percent={60} /> |
|
|
|
|
</Link> |
|
|
|
|
</li> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
return ( |
|
|
|
|
<div className="w-full px-4"> |
|
|
|
|
<div className="w-full flex flex-col rounded-md py-4 overflow-hidden"> |
|
|
|
|
<div className="w-full flex flex-col py-4 lg:px-3 overflow-hidden lg:border lg:border-solid lg:border-gray-200 rounded-md"> |
|
|
|
|
<header className="w-full flex flex-row justify-between items-center"> |
|
|
|
|
<strong className="text-blueC0 dark:text-white font-bold text-sm"> |
|
|
|
|
<strong className="text-blueC0 dark:text-white font-bold text-sm lg:text-base"> |
|
|
|
|
دورههای ویدئویی شما |
|
|
|
|
</strong> |
|
|
|
|
<img |
|
|
|
|
src={isDark ? arrowWhiteIcon : arrowBlueIcon} |
|
|
|
|
alt="" |
|
|
|
|
className={`transform ${isDark ? 'w-7' : 'rotate-180'}`} |
|
|
|
|
className={`transform lg:hidden ${isDark ? "w-7" : "rotate-180"}`} |
|
|
|
|
/> |
|
|
|
|
</header> |
|
|
|
|
<ul className="list-none w-full overflow-x-scroll pt-3 flex flex-row"> |
|
|
|
|
{list.map((book, index) => ( |
|
|
|
|
<Book book={book} key={index} grades={grades} /> |
|
|
|
|
<ul className="list-none w-full overflow-x-scroll pt-3 gap-3 lg:gap-5 flex flex-row lg:pt-5 lg:flex-wrap lg:overflow-y-scroll"> |
|
|
|
|
{list.slice(0,5)?.map((book, index) => ( |
|
|
|
|
<Book book={book} key={index} /> |
|
|
|
|
))} |
|
|
|
|
</ul> |
|
|
|
|
</div> |
|
|
|
@ -33,35 +58,11 @@ function Videos({ list, getList, grades, isDark }) { |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const Book = ({ book, grades }) => { |
|
|
|
|
return ( |
|
|
|
|
<li className="flex flex-col ml-3"> |
|
|
|
|
<Link to={"/products/" + book.name}> |
|
|
|
|
<img |
|
|
|
|
src={`https://dnvn.ir/api/v1/file/${book.fileIds}`} |
|
|
|
|
alt="" |
|
|
|
|
className="rounded-sm" |
|
|
|
|
style={{ |
|
|
|
|
maxHeight: "calc(100vw / 2 * 2 / 3)", |
|
|
|
|
minWidth: "calc(100vw / 2 )", |
|
|
|
|
}} |
|
|
|
|
/> |
|
|
|
|
<h2 className="mt-2 text-sm font-semibold text-blue5F dark:text-white"> |
|
|
|
|
{book.name} |
|
|
|
|
</h2> |
|
|
|
|
<p className="font-medium text-blueC0 dark:text-greenBA text-xs mt-1">{`پایه ${ |
|
|
|
|
grades[book.gradeId] |
|
|
|
|
}`}</p>
|
|
|
|
|
<Progress percent={60} /> |
|
|
|
|
</Link> |
|
|
|
|
</li> |
|
|
|
|
); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const mapStateToProps = (state) => ({ |
|
|
|
|
list: state.book.list, |
|
|
|
|
grades: state.publicApi.grades, |
|
|
|
|
isDark: state.publicApi.isDark, |
|
|
|
|
isMobile: state.publicApi.isMobile |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
export default connect(mapStateToProps, { getList: book.list })(Videos); |
|
|
|
|