reza added hdesktop home light mode

master
Reza 3 years ago
parent 157d4e8f0c
commit ad5487f722
  1. 10
      src/components/GradeFilter/index.scss
  2. 40
      src/components/GradeFilter/index.tsx
  3. 10
      src/components/HomeSearchBox/index.scss
  4. 4
      src/components/HomeSearchBox/index.tsx
  5. 14
      src/components/Navbar/index.scss
  6. 2
      src/components/Navbar/index.tsx
  7. 6
      src/constants/colors.scss
  8. 27
      src/views/Home/Blogs/index.scss
  9. 14
      src/views/Home/Blogs/index.tsx
  10. 7
      src/views/Home/Books/Book/index.scss
  11. 4
      src/views/Home/Books/Book/index.tsx
  12. 4
      src/views/Home/Courses/Course/index.scss
  13. 4
      src/views/Home/Courses/Course/index.tsx
  14. 27
      src/views/Home/Courses/index.scss
  15. 21
      src/views/Home/Courses/index.tsx
  16. 10
      src/views/Home/Footer/index.scss
  17. 2
      src/views/Home/Footer/index.tsx
  18. 16
      src/views/Home/Header/index.scss
  19. 19
      src/views/Home/Header/index.tsx
  20. 4
      src/views/Home/index.tsx

@ -8,10 +8,10 @@
&__box{ &__box{
display: none !important; display: none !important;
} }
&__light{ &-light{
color: black; color: $gray5;
background-color: white; background-color: $gray13;
border: 1px solid black; border: none;
.grade-filter__list{ .grade-filter__list{
background-color: white; background-color: white;
border: 1px solid black; border: 1px solid black;
@ -37,7 +37,7 @@
height: 100%; height: 100%;
width : calc(100% / 12); width : calc(100% / 12);
transition: right 0.5s; transition: right 0.5s;
background-color: $green; background-color: $green5;
box-shadow: 0px 0px 20px $green; box-shadow: 0px 0px 20px $green;
z-index: 50; z-index: 50;
} }

@ -1,11 +1,17 @@
import React, { useState, useEffect, useRef } from "react"; import React, { useState, useEffect, useRef } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { book } from "../../redux/actions"; import { book } from "../../redux/actions";
import _ from 'lodash'; import _ from "lodash";
import dropdown from "../../assets/icons/dropdown.png"; import dropdown from "../../assets/icons/dropdown.png";
function GradeFilter({
function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGradeDropdown, theme}: any) { selectedGrade,
gradeFilter,
grades,
gradeDropdown,
setGradeDropdown,
theme,
}: any) {
const [arrowTop, setArrowTop] = useState(false); const [arrowTop, setArrowTop] = useState(false);
useEffect(() => { useEffect(() => {
@ -17,10 +23,18 @@ function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGrad
const setDropdown = (e: any) => { const setDropdown = (e: any) => {
e.stopPropagation(); e.stopPropagation();
setGradeDropdown(!gradeDropdown); setGradeDropdown(!gradeDropdown);
} };
return ( return (
<section className={_.join(["grade-filter d-flex align-items-center", theme === 'light' ? 'grade-filter__light' : 'grade-filter__dark']," ")}> <section
className={_.join(
[
"grade-filter d-flex align-items-center",
theme === "light" ? "grade-filter-light" : "grade-filter-dark",
],
" "
)}
>
<h1 className="d-flex align-items-center"> <h1 className="d-flex align-items-center">
پایه تحصیلی پایه تحصیلی
<span className="desktop"></span> <span className="desktop"></span>
@ -45,10 +59,10 @@ function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGrad
{grades.map((item: any, i: any) => ( {grades.map((item: any, i: any) => (
<li <li
key={i} key={i}
onClick={() => onClick={() => gradeFilter(item.value)}
gradeFilter(item.value) className={
selectedGrade === item.value ? "grade-filter__list--active" : ""
} }
className={selectedGrade === item.value ? "grade-filter__list--active" : ""}
> >
{item.name} {item.name}
</li> </li>
@ -57,7 +71,15 @@ function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGrad
) : null} ) : null}
<ul className="desktop align-items-center" ref={mobileList}> <ul className="desktop align-items-center" ref={mobileList}>
{ selectedGrade && <figure style={{ right : (mobileList as any).current?.offsetWidth / 12 * (selectedGrade - 1) }}></figure> } {selectedGrade && (
<figure
style={{
right:
((mobileList as any).current?.offsetWidth / 12) *
(selectedGrade - 1),
}}
></figure>
)}
{grades.map((item: any, i: any) => ( {grades.map((item: any, i: any) => (
<li <li
key={i} key={i}

@ -5,7 +5,7 @@
* { * {
transition: all 0.5s; transition: all 0.5s;
} }
&__dark{ &-dark{
form { form {
button { button {
background-color: $gray1; background-color: $gray1;
@ -24,16 +24,16 @@
} }
} }
} }
&__light{ &-light{
form { form {
button { button {
background-color: $gray1; background-color: $gray1;
border: none; border: none;
} }
input { input {
border: 1px solid $gray5 !important; color: $gray5;
color: black; border: none !important;
background-color: white !important; background-color: $gray12 !important;
&::placeholder { &::placeholder {
color: black !important; color: black !important;
} }

@ -28,8 +28,8 @@ function HomeSearchBox({
[ [
"home-search-box d-flex flex-column align-items-center", "home-search-box d-flex flex-column align-items-center",
theme === "light" theme === "light"
? "home-search-box__light" ? "home-search-box-light"
: "home-search-box__dark", : "home-search-box-dark",
], ],
" " " "
)} )}

@ -6,17 +6,21 @@
top: 0px !important; top: 0px !important;
left: 0px; left: 0px;
z-index: 150; z-index: 150;
&__light{ &-light{
background-color: white; background-color: white;
.nav___share{ .nav___share{
background-color: $gray1 !important; background-color: inherit !important;
border: none !important; border: 1px solid $green1 !important;
a{
color: $green1 !important;
}
} }
.MuiButton-root{ .MuiButton-root{
color: black !important; color: $gray5 !important;
} }
} }
&__dark{ &-dark{
background-color: black; background-color: black;
} }
&__container{ &__container{

@ -68,7 +68,7 @@ function Navbar(props: any) {
<nav <nav
className={_.join([ className={_.join([
"nav align-items-center justify-content-center", "nav align-items-center justify-content-center",
theme === "light" ? "nav__light" : "nav__dark", theme === "light" ? "nav-light" : "nav-dark",
], " ")} ], " ")}
> >
<div className="nav__container d-flex align-items-center justify-content-between"> <div className="nav__container d-flex align-items-center justify-content-between">

@ -4,20 +4,22 @@ $gray1 : #383838;
$gray2 : #6c6c6c; $gray2 : #6c6c6c;
$gray3 : rgb(143, 142, 142); $gray3 : rgb(143, 142, 142);
$gray4 : #666666; $gray4 : #666666;
$gray5 : #46454a; $gray5 : #555;
$gray6 : #ddd; $gray6 : #ddd;
$gray7 : #797979; $gray7 : #797979;
$gray8 : #272727; $gray8 : #272727;
$gray9 : #b3b3b3; $gray9 : #b3b3b3;
$gray10 : #cccccc; $gray10 : #cccccc;
$gray11 : #969696; $gray11 : #969696;
$gray12 : #e3e3e3; $gray12 : #e9e9e9;
$gray13 : #f6f6f6;
// green // green
$green : #4dd35b; $green : #4dd35b;
$green1 : #81C342; $green1 : #81C342;
$green2 : #6cbe44; $green2 : #6cbe44;
$green3 : #00cc69; $green3 : #00cc69;
$green4 : #84de56; $green4 : #84de56;
$green5 : #9cdf52;
// blue // blue
$blue : #a2b4cb; $blue : #a2b4cb;

@ -7,9 +7,7 @@
margin-top: 10px; margin-top: 10px;
padding: 0px 10px 50px; padding: 0px 10px 50px;
font-family: numeralLight; font-family: numeralLight;
&__list{ &-dark{
width: 100%;
}
header{ header{
margin-bottom: 20px; margin-bottom: 20px;
h1{ h1{
@ -22,6 +20,29 @@
} }
} }
}
&-light{
header{
h1{
color: $green;
}
span{
}
}
}
&__list{
width: 100%;
}
header{
margin-bottom: 20px;
h1{
font-family: numeralMedium;
margin: 0px;
}
}
} }

@ -4,7 +4,7 @@ import { Carousel } from "3d-react-carousal";
import Blog from "./Blog/index"; import Blog from "./Blog/index";
import { connect, useSelector } from "react-redux"; import { connect, useSelector } from "react-redux";
import { blog } from "../../../redux/actions"; import { blog } from "../../../redux/actions";
import _ from "lodash";
function Blogs(props: any) { function Blogs(props: any) {
const slideNumberHandler = () => { const slideNumberHandler = () => {
@ -22,8 +22,18 @@ function Blogs(props: any) {
useEffect(() => { useEffect(() => {
props.getList(); props.getList();
}, []); }, []);
const light = props.theme === "light";
return ( return (
<section className="home-blogs d-flex flex-column"> <section
className={_.join(
[
"home-blogs d-flex flex-column",
light ? "home-blogs-light" : "home-blogs-dark",
],
" "
)}
>
<header className="d-flex flex-column"> <header className="d-flex flex-column">
<h1>پیشنهادهای داغ برای شما</h1> <h1>پیشنهادهای داغ برای شما</h1>
</header> </header>

@ -2,10 +2,11 @@
cursor: pointer; cursor: pointer;
transition: all 0.5s; transition: all 0.5s;
border: 1px solid black; border: 1px solid black;
padding: 10px; margin: 10px;
border-radius: 10px; border-radius: 10px;
&__light{ &-light{
border: none; border : none !important;
border-bottom: 1px solid $gray12 !important;
h2{ h2{
color: black !important; color: black !important;
} }

@ -19,8 +19,8 @@ function Book(props: any) {
[ [
"home-books-book d-flex flex-column", "home-books-book d-flex flex-column",
theme === "light" theme === "light"
? "home-books-book__light" ? "home-books-book-light"
: "home-books-book__dark", : "home-books-book-dark",
], ],
" " " "
)} )}

@ -4,10 +4,10 @@
transition: all 0.5s; transition: all 0.5s;
border: 1px solid black; border: 1px solid black;
border-radius: 10px; border-radius: 10px;
&__light{ &-light{
border: none; border: none;
h2{ h2{
color: black !important; color: $gray5 !important;
} }
} }
img{ img{

@ -13,8 +13,8 @@ function Course(props: any) {
[ [
"home-courses-course d-flex flex-column", "home-courses-course d-flex flex-column",
theme === "light" theme === "light"
? "home-courses-course__light" ? "home-courses-course-light"
: "home-courses-course__dark", : "home-courses-course-dark",
], ],
" " " "
)} )}

@ -1,14 +1,30 @@
@import './Course/index.scss'; @import "./Course/index.scss";
.home-courses { .home-courses {
width: 100%; width: 100%;
margin: 0px auto; margin: 0px auto;
border-top: 1px solid $gray8;
border-bottom: 1px solid $gray8;
position: relative; position: relative;
margin-top: 30px; padding: 20px 10px 30px;
padding: 20px 10px 50px;
font-family: numeralLight; font-family: numeralLight;
&-dark {
border-top: 1px solid $gray8;
border-bottom: 1px solid $gray8;
}
&-light{
border-top: none !important;
border-bottom: 1px solid $gray12;
header{
h1{
color : $green4 !important;
}
a{
color: $green !important;
}
}
.home-courses__more{
background-color: white !important;
}
}
header { header {
margin-bottom: 20px; margin-bottom: 20px;
h1 { h1 {
@ -96,7 +112,6 @@
overflow-x: scroll; overflow-x: scroll;
} }
} }
} }
@media screen and (max-width: 640px) { @media screen and (max-width: 640px) {

@ -3,9 +3,10 @@ import Carousel from "react-elastic-carousel";
import Course from "./Course/index"; import Course from "./Course/index";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import ExpandMoreRoundedIcon from "@mui/icons-material/ExpandMoreRounded"; import ExpandMoreRoundedIcon from "@mui/icons-material/ExpandMoreRounded";
import { connect } from 'react-redux'; import { connect } from "react-redux";
import _ from "lodash";
function Courses({ number, courses, selectedSort }: any) { function Courses({ number, courses, selectedSort, theme }: any) {
const slideNumberHandler = () => { const slideNumberHandler = () => {
if (window.innerWidth >= 1440) { if (window.innerWidth >= 1440) {
return 5; return 5;
@ -17,16 +18,20 @@ function Courses({ number, courses, selectedSort }: any) {
return 2; return 2;
} }
}; };
const light = theme === "light";
return ( return (
<section className="home-courses d-flex flex-column"> <section
className={_.join([
"home-courses d-flex flex-column",
light ? "home-courses-light" : "home-courses-dark",
], " ")}
>
<header className="d-flex justify-content-between"> <header className="d-flex justify-content-between">
<div className="d-flex flex-column"> <div className="d-flex flex-column">
<h1>{selectedSort}</h1> <h1>{selectedSort}</h1>
{/* <span>در این قسمت شاید یک متن جهت زیباسازی قرار بگیرد.</span> */} {/* <span>در این قسمت شاید یک متن جهت زیباسازی قرار بگیرد.</span> */}
</div> </div>
<Link to="/"> <Link to="/">بیشتر</Link>
بیشتر
</Link>
</header> </header>
{window.innerWidth > 1007 ? ( {window.innerWidth > 1007 ? (
<Carousel <Carousel
@ -49,7 +54,7 @@ function Courses({ number, courses, selectedSort }: any) {
)} )}
<Link <Link
className="home-courses__more align-items-center mobile" className="home-courses__more align-items-center desktop"
to="/courses" to="/courses"
> >
مشاهده بیشتر{" "} مشاهده بیشتر{" "}
@ -61,4 +66,4 @@ function Courses({ number, courses, selectedSort }: any) {
export default connect((state: any) => ({ export default connect((state: any) => ({
selectedSort: state.book.selectedSort, selectedSort: state.book.selectedSort,
}))(Courses) }))(Courses);

@ -1,12 +1,14 @@
.footer{ .footer{
width: 100%; width: 100%;
font-family: numeralLight; font-family: numeralLight;
background-color: #1a1a1a; &-light{
&__light{ background-color: $gray13;
background-color: white;
p,a{ p,a{
color: black !important; color: $gray5 !important;
}
} }
&-dark{
background-color: #1a1a1a;
} }
&__container{ &__container{
width: 100%; width: 100%;

@ -10,7 +10,7 @@ function Footer(props: any) {
scroll.goToTop() scroll.goToTop()
}, []); }, []);
return ( return (
<footer className={_.join(["footer desktop", theme === 'light' ? 'footer__light' : 'footer__dark'], " ")}> <footer className={_.join(["footer desktop", theme === 'light' ? 'footer-light' : 'footer-dark'], " ")}>
<div className="footer__container d-flex justify-content-between align-items-center"> <div className="footer__container d-flex justify-content-between align-items-center">
<ul className="d-flex"> <ul className="d-flex">
{links.map((item: any, i: any) => {links.map((item: any, i: any) =>

@ -3,6 +3,22 @@
width: 100%; width: 100%;
margin: 0px auto; margin: 0px auto;
margin-top: 10px; margin-top: 10px;
&-dark{
.carousel-indicators{
li{
background-color: inherit !important;
}
}
}
&-light{
.carousel-indicators{
li{
padding: 5px;
border-radius: 5px !important;
background-color: rgba(255, 255, 255, 0.281) !important;
}
}
}
span { span {
height: 80%; height: 80%;
width: 8px; width: 8px;

@ -1,17 +1,28 @@
import React from "react"; import React from "react";
import Avatar from '@mui/material/Avatar'; import Avatar from "@mui/material/Avatar";
import _ from "lodash";
export default function Header(props: any) { export default function Header(props: any) {
const { headerData } = props; const { headerData, theme } = props;
return ( return (
<header className="home-header"> <header
className={_.join(
[
"home-header",
theme === "light" ? "home-header-light" : "home-header-dark",
],
" "
)}
>
<div id="myCarousel" className="carousel slide" data-ride="carousel"> <div id="myCarousel" className="carousel slide" data-ride="carousel">
<div className="carousel-inner"> <div className="carousel-inner">
{headerData.map((item: any, i: any) => ( {headerData.map((item: any, i: any) => (
<div <div
className={i === 0 ? "item active" : "item"} className={i === 0 ? "item active" : "item"}
style={{ style={{
background: `url(${"https://dnvn.ir/api/v1/file/" + item.fileId})`, background: `url(${
"https://dnvn.ir/api/v1/file/" + item.fileId
})`,
}} }}
// dataBackgroundImage={`https://dnvn.ir/api/v1/file/${item.fileId}`} // dataBackgroundImage={`https://dnvn.ir/api/v1/file/${item.fileId}`}
key={i} key={i}

@ -57,7 +57,7 @@ function Home({
> >
<Navbar /> <Navbar />
<div className="desktop"> <div className="desktop">
<Header headerData={headerData} /> <Header headerData={headerData} theme={theme} />
</div> </div>
<HomeSearchBox <HomeSearchBox
setVocal={setVocal} setVocal={setVocal}
@ -65,7 +65,7 @@ function Home({
setInputValue={setInputValue} setInputValue={setInputValue}
theme={theme} theme={theme}
/> />
<Courses courses={sortFilterCourse ? sortFilterCourse : courseList} /> <Courses courses={sortFilterCourse ? sortFilterCourse : courseList} theme={theme} />
<GradeFilter <GradeFilter
grades={grades} grades={grades}
grade={grade} grade={grade}

Loading…
Cancel
Save