reza changed home theme

master
Reza 3 years ago
parent f4c3d552f5
commit a3c35eb82d
  1. 9
      src/components/GradeFilter/index.scss
  2. 9
      src/components/GradeFilter/index.tsx
  3. 46
      src/components/HomeSearchBox/index.scss
  4. 15
      src/components/HomeSearchBox/index.tsx
  5. 14
      src/components/Navbar/index.scss
  6. 29
      src/components/Navbar/index.tsx
  7. 1
      src/views/About/index.tsx
  8. 6
      src/views/Home/Books/Book/index.scss
  9. 44
      src/views/Home/Books/Book/index.tsx
  10. 4
      src/views/Home/Books/index.tsx
  11. 6
      src/views/Home/Courses/Course/index.scss
  12. 38
      src/views/Home/Courses/Course/index.tsx
  13. 4
      src/views/Home/Courses/index.tsx
  14. 6
      src/views/Home/Footer/index.scss
  15. 6
      src/views/Home/Footer/index.tsx
  16. 13
      src/views/Home/index.tsx

@ -8,6 +8,15 @@
&__box{ &__box{
display: none !important; display: none !important;
} }
&__light{
color: black;
background-color: white;
border: 1px solid black;
.grade-filter__list{
background-color: white;
border: 1px solid black;
}
}
h1{ h1{
margin: 0px; margin: 0px;
padding: 0px 15px; padding: 0px 15px;

@ -1,11 +1,11 @@
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 dropdown from "../../assets/icons/dropdown.png"; import dropdown from "../../assets/icons/dropdown.png";
function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGradeDropdown}: any) { function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGradeDropdown, theme}: any) {
const [arrowTop, setArrowTop] = useState(false); const [arrowTop, setArrowTop] = useState(false);
useEffect(() => { useEffect(() => {
@ -20,13 +20,13 @@ function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGrad
} }
return ( return (
<section className="grade-filter d-flex align-items-center"> <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>
</h1> </h1>
<div <div
className="grade-filter__box d-flex" className="grade-filter__box mobile"
onClick={(e : any) => setDropdown(e)} onClick={(e : any) => setDropdown(e)}
> >
{selectedGrade ? ( {selectedGrade ? (
@ -75,6 +75,7 @@ function GradeFilter({selectedGrade, gradeFilter, grades, gradeDropdown, setGrad
export default connect( export default connect(
(state: any) => ({ (state: any) => ({
selectedGrade: state.book.selectedGrade, selectedGrade: state.book.selectedGrade,
theme : state.publicApi.theme,
}), }),
{ gradeFilter: book.gradeFilter } { gradeFilter: book.gradeFilter }
)(GradeFilter); )(GradeFilter);

@ -5,24 +5,56 @@
* { * {
transition: all 0.5s; transition: all 0.5s;
} }
&__dark{
form {
button {
background-color: $gray1;
}
input {
background-color: $gray5;
border: 0px;
color: $gray6;
&::placeholder {
color: $gray6;
}
&:focus {
outline: 2px solid $green !important;
}
}
}
}
&__light{
form {
button {
background-color: $gray1;
border: none;
}
input {
border: 1px solid $gray5 !important;
color: black;
background-color: white !important;
&::placeholder {
color: black !important;
}
&:focus {
outline: 2px solid $green !important;
}
}
}
}
form { form {
button { button {
background-color: $gray1;
margin-right: 3px; margin-right: 3px;
border-top-left-radius: 9px; border-top-left-radius: 9px;
border-bottom-left-radius: 9px; border-bottom-left-radius: 9px;
border: 0px;
} }
input { input {
width: 100%; width: 100%;
background-color: $gray5;
border: 0px;
border-top-right-radius: 9px; border-top-right-radius: 9px;
border-bottom-right-radius: 9px; border-bottom-right-radius: 9px;
color: $gray6;
&::placeholder { &::placeholder {
padding-right: 0px; padding-right: 0px;
color: $gray6;
opacity: 0.4; opacity: 0.4;
} }
&:focus { &:focus {
@ -195,7 +227,7 @@
background: $gray1; background: $gray1;
&::placeholder { &::placeholder {
font-size: calc(100vw / 34); font-size: calc(100vw / 34);
color: white !important; color: white;
} }
} }
button { button {

@ -1,5 +1,6 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import _ from "lodash";
import { book } from "../../redux/actions"; import { book } from "../../redux/actions";
import search from "../../assets/icons/search.png"; import search from "../../assets/icons/search.png";
import voice from "../../assets/icons/voice.png"; import voice from "../../assets/icons/voice.png";
@ -11,6 +12,7 @@ function HomeSearchBox({
setInputValue, setInputValue,
sortFilter, sortFilter,
selectedSort, selectedSort,
theme,
}: any) { }: any) {
const submitInput = (value: any) => { const submitInput = (value: any) => {
setInputValue(value); setInputValue(value);
@ -21,7 +23,17 @@ function HomeSearchBox({
sortFilter({ search: inputValue, sort: value }); sortFilter({ search: inputValue, sort: value });
}; };
return ( return (
<section className="home-search-box d-flex flex-column align-items-center"> <section
className={_.join(
[
"home-search-box d-flex flex-column align-items-center",
theme === "light"
? "home-search-box__light"
: "home-search-box__dark",
],
" "
)}
>
<form className="d-flex" onSubmit={(e) => e.preventDefault()}> <form className="d-flex" onSubmit={(e) => e.preventDefault()}>
<input <input
type="search" type="search"
@ -73,6 +85,7 @@ function HomeSearchBox({
export default connect( export default connect(
(state: any) => ({ (state: any) => ({
selectedSort: state.book.selectedSort, selectedSort: state.book.selectedSort,
theme: state.publicApi.theme,
}), }),
{ sortFilter: book.sortFilter } { sortFilter: book.sortFilter }
)(HomeSearchBox); )(HomeSearchBox);

@ -1,13 +1,21 @@
.nav{ .nav{
width: 100%; width: 100%;
background-color: black;
height: 60px; height: 60px;
padding: 0px 10px; padding: 0px 10px;
position: fixed !important; position: fixed !important;
top: 0px !important; top: 0px !important;
left: 0px; left: 0px;
z-index: 150; z-index: 150;
&__light{
background-color: white;
.nav___share{
background-color: $gray1 !important;
border: none !important;
}
}
&__dark{
background-color: black;
}
&__container{ &__container{
width: 100%; width: 100%;
font-family: numeralLight; font-family: numeralLight;
@ -115,7 +123,6 @@
@media screen and (min-width: 641px) and (max-width: 1007px){ @media screen and (min-width: 641px) and (max-width: 1007px){
.nav{ .nav{
background-color: black;
&__container{ &__container{
max-width: 900px; max-width: 900px;
&--buttons{ &--buttons{
@ -137,7 +144,6 @@
@media screen and (max-width: 640px){ @media screen and (max-width: 640px){
.nav{ .nav{
background-color: black;
&__container{ &__container{
max-width: 500px; max-width: 500px;
&--buttons{ &--buttons{

@ -6,8 +6,10 @@ import NavbarDrawer from "../NavbarDrawer/NavbarDrawer";
import clsx from "clsx"; import clsx from "clsx";
import proxy from "../../redux/proxy"; import proxy from "../../redux/proxy";
import { makeStyles } from "@mui/styles"; import { makeStyles } from "@mui/styles";
import Menu from '../Menu/index'; import Menu from "../Menu/index";
import logoIcon from '../../assets/icons/logo.png'; import logoIcon from "../../assets/icons/logo.png";
import { connect } from "react-redux";
import _ from "lodash";
const useStyles = makeStyles({ const useStyles = makeStyles({
list: { list: {
@ -20,7 +22,7 @@ const useStyles = makeStyles({
}, },
}); });
export default function Navbar(props: any) { function Navbar(props: any) {
const status = proxy.status(); const status = proxy.status();
const classes = useStyles(); const classes = useStyles();
const [state, setState] = useState({ const [state, setState] = useState({
@ -30,7 +32,7 @@ export default function Navbar(props: any) {
right: false, right: false,
searchFlag: false, searchFlag: false,
}); });
const { page } = props; const { page, theme } = props;
const toggleDrawer = (anchor: any, open: any) => (event: any) => { const toggleDrawer = (anchor: any, open: any) => (event: any) => {
console.log("on"); console.log("on");
@ -63,11 +65,18 @@ export default function Navbar(props: any) {
const userStatus = proxy.status(); const userStatus = proxy.status();
return ( return (
<nav className="nav align-items-center justify-content-center"> <nav
className={_.join([
"nav align-items-center justify-content-center",
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">
<ul className="nav__container--links desktop align-items-center"> <ul className="nav__container--links desktop align-items-center">
<li className="nav___logo d-flex align-items-center"> <li className="nav___logo d-flex align-items-center">
<Link to="/"><img src={logoIcon} alt="" /></Link> <Link to="/">
<img src={logoIcon} alt="" />
</Link>
<span></span> <span></span>
</li> </li>
<li> <li>
@ -76,7 +85,7 @@ export default function Navbar(props: any) {
</ul> </ul>
<MenuRoundedIcon <MenuRoundedIcon
className="mobile" className="mobile"
style={{ color: "white", fontSize: 40 }} style={{ color: theme === "dark" ? "white" : "black", fontSize: 40 }}
onClick={toggleDrawer("right", true)} onClick={toggleDrawer("right", true)}
/> />
<ul className="nav__container--buttons d-flex align-items-center"> <ul className="nav__container--buttons d-flex align-items-center">
@ -102,6 +111,10 @@ export default function Navbar(props: any) {
); );
} }
export default connect((state: any) => ({
theme: state.publicApi.theme,
}))(Navbar);
Navbar.defaultProps = { Navbar.defaultProps = {
grades: [ grades: [
{ {
@ -153,4 +166,4 @@ Navbar.defaultProps = {
value: 12, value: 12,
}, },
], ],
} };

@ -16,7 +16,6 @@ function About({ fury, advantages, keywords, keywords2, first, theme, setTheme }
"about main d-flex flex-column", "about main d-flex flex-column",
theme === "dark" ? "main__light" : "main__dark", theme === "dark" ? "main__light" : "main__dark",
], " ")} ], " ")}
onClick={() => setTheme('dark')}
> >
<Navbar /> <Navbar />
<main className="d-flex flex-column align-items-center"> <main className="d-flex flex-column align-items-center">

@ -4,6 +4,12 @@
border: 1px solid black; border: 1px solid black;
padding: 10px; padding: 10px;
border-radius: 10px; border-radius: 10px;
&__light{
border: none;
h2{
color: black !important;
}
}
img{ img{
border-radius: 8px; border-radius: 8px;
} }

@ -1,18 +1,36 @@
import React from "react"; import React from "react";
import { Link } from 'react-router-dom'; import { Link } from "react-router-dom";
import { connect } from "react-redux";
import _ from "lodash";
export default function Book(props: any) { function Book(props: any) {
const { data } = props; const { data, theme } = props;
const desc: any = { const desc: any = {
"ریاضی": 'ریاضی از ریاضت میاد ولی دانوین آسون و لذت بخشش کرده', ریاضی: "ریاضی از ریاضت میاد ولی دانوین آسون و لذت بخشش کرده",
'علوم تجربی': "علوم تجربی تو دانوین واقعا تجربی و محسوس میشه", "علوم تجربی": "علوم تجربی تو دانوین واقعا تجربی و محسوس میشه",
'زیست شناسی': "زیست را در دانوین باید زیست", "زیست شناسی": "زیست را در دانوین باید زیست",
'شیمی': 'شیمی اینجا می فهمه کیمیا یعنی چی', شیمی: "شیمی اینجا می فهمه کیمیا یعنی چی",
'فیزیک': "با دانوین فیزیکو با یه لنز جدید ببنید" فیزیک: "با دانوین فیزیکو با یه لنز جدید ببنید",
} };
return ( return (
<Link to={`/courses/${data.id}`} className="home-books-book d-flex flex-column" draggable={'false'}> <Link
<img src={`https://dnvn.ir/api/v1/file/${data.fileIds}`} alt={data.name} draggable={'false'} /> to={`/courses/${data.id}`}
className={_.join(
[
"home-books-book d-flex flex-column",
theme === "light"
? "home-books-book__light"
: "home-books-book__dark",
],
" "
)}
draggable={"false"}
>
<img
src={`https://dnvn.ir/api/v1/file/${data.fileIds}`}
alt={data.name}
draggable={"false"}
/>
<footer className="d-flex"> <footer className="d-flex">
<div className="home-books-book__info d-flex flex-column"> <div className="home-books-book__info d-flex flex-column">
<h2>{data.name}</h2> <h2>{data.name}</h2>
@ -22,3 +40,7 @@ export default function Book(props: any) {
</Link> </Link>
); );
} }
export default connect((state: any) => ({
theme: state.publicApi.theme,
}))(Book);

@ -30,13 +30,13 @@ function Books({list, number}: any) {
showArrows={true} showArrows={true}
pagination={false} pagination={false}
> >
{list?.map((item: Object, i: Number) => ( {list?.map((item: Object, i: any) => (
<Book data={item} key={i} /> <Book data={item} key={i} />
))} ))}
</Carousel> </Carousel>
) : ( ) : (
<div className="home-books__list d-flex"> <div className="home-books__list d-flex">
{list?.map((item: Object, i: Number) => ( {list?.map((item: Object, i: any) => (
<Book data={item} key={i} /> <Book data={item} key={i} />
))} ))}
</div> </div>

@ -4,6 +4,12 @@
transition: all 0.5s; transition: all 0.5s;
border: 1px solid black; border: 1px solid black;
border-radius: 10px; border-radius: 10px;
&__light{
border: none;
h2{
color: black !important;
}
}
img{ img{
border-radius: 8px; border-radius: 8px;
margin: 0px auto; margin: 0px auto;

@ -1,15 +1,35 @@
import React from "react"; import React from "react";
import Avatar from "@mui/material/Avatar"; import Avatar from "@mui/material/Avatar";
import {Link} from 'react-router-dom'; import { Link } from "react-router-dom";
import { connect } from "react-redux";
import _ from "lodash";
function Course(props: any) {
export default function Course(props: any) { const { data, theme } = props;
const { data } = props;
return ( return (
<Link to={`/courses/${data.id}`} className="home-courses-course d-flex flex-column" draggable={'false'}> <Link
<img src={`https://dnvn.ir/api/v1/file/${data.fileIds}`} alt={data.name} draggable={'false'} /> to={`/courses/${data.id}`}
className={_.join(
[
"home-courses-course d-flex flex-column",
theme === "light"
? "home-courses-course__light"
: "home-courses-course__dark",
],
" "
)}
draggable={"false"}
>
<img
src={`https://dnvn.ir/api/v1/file/${data.fileIds}`}
alt={data.name}
draggable={"false"}
/>
<footer className="d-flex"> <footer className="d-flex">
<Avatar src={`https://dnvn.ir/api/v1/file/${data.fileIds}`} style={{ width: 40, height: 40 }} /> <Avatar
src={`https://dnvn.ir/api/v1/file/${data.fileIds}`}
style={{ width: 40, height: 40 }}
/>
<div className="home-courses-course__info d-flex flex-column"> <div className="home-courses-course__info d-flex flex-column">
<h2>{data.name}</h2> <h2>{data.name}</h2>
{/* {window.innerWidth > 1007 ? ( {/* {window.innerWidth > 1007 ? (
@ -35,3 +55,7 @@ export default function Course(props: any) {
</Link> </Link>
); );
} }
export default connect((state: any) => ({
theme: state.publicApi.theme,
}))(Course);

@ -36,13 +36,13 @@ function Courses({ number, courses, selectedSort }: any) {
showArrows={true} showArrows={true}
pagination={false} pagination={false}
> >
{courses?.map((item: Object, i: Number) => ( {courses?.map((item: Object, i:any) => (
<Course data={item} key={i} /> <Course data={item} key={i} />
))} ))}
</Carousel> </Carousel>
) : ( ) : (
<div className="home-courses__list d-flex"> <div className="home-courses__list d-flex">
{courses?.map((item: Object, i: Number) => ( {courses?.map((item: Object, i: any) => (
<Course data={item} key={i} /> <Course data={item} key={i} />
))} ))}
</div> </div>

@ -2,6 +2,12 @@
width: 100%; width: 100%;
font-family: numeralLight; font-family: numeralLight;
background-color: #1a1a1a; background-color: #1a1a1a;
&__light{
background-color: white;
p,a{
color: black !important;
}
}
&__container{ &__container{
width: 100%; width: 100%;
margin : 0px auto; margin : 0px auto;

@ -1,15 +1,15 @@
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import scroll from "../../../util/scroll"; import scroll from "../../../util/scroll";
import _ from 'lodash';
export default function Footer(props: any) { export default function Footer(props: any) {
const { links } = props; const { links, theme } = props;
useEffect(() => { useEffect(() => {
scroll.goToTop() scroll.goToTop()
}, []); }, []);
return ( return (
<footer className="footer desktop"> <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) =>

@ -13,6 +13,7 @@ import scroll from "../../util/scroll";
import Loader from "../../components/Loader"; import Loader from "../../components/Loader";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { book, publicApi } from "../../redux/actions"; import { book, publicApi } from "../../redux/actions";
import _ from 'lodash';
function Home({ function Home({
courseList, courseList,
@ -27,6 +28,7 @@ function Home({
getHeader, getHeader,
bookLoading, bookLoading,
publicLoading, publicLoading,
theme
}: any) { }: any) {
const [grade, setGrade] = useState(null); const [grade, setGrade] = useState(null);
const [vocal, setVocal] = useState(false); const [vocal, setVocal] = useState(false);
@ -47,7 +49,7 @@ function Home({
return ( return (
<> <>
<div <div
className="home main d-flex flex-column" className={_.join(["home main d-flex flex-column", theme === 'dark' ? 'main__dark' : 'main__light'], " ")}
style={{ style={{
filter: vocal || bookLoading || publicLoading ? "blur(8px)" : "", filter: vocal || bookLoading || publicLoading ? "blur(8px)" : "",
}} }}
@ -61,6 +63,7 @@ function Home({
setVocal={setVocal} setVocal={setVocal}
inputValue={inputValue} inputValue={inputValue}
setInputValue={setInputValue} setInputValue={setInputValue}
theme={theme}
/> />
<Courses courses={sortFilterCourse ? sortFilterCourse : courseList} /> <Courses courses={sortFilterCourse ? sortFilterCourse : courseList} />
<GradeFilter <GradeFilter
@ -69,11 +72,12 @@ function Home({
setGrade={setGrade} setGrade={setGrade}
gradeDropdown={gradeDropdown} gradeDropdown={gradeDropdown}
setGradeDropdown={setGradeDropdown} setGradeDropdown={setGradeDropdown}
theme={theme}
/> />
<Books list={gradeFilterBooks ? gradeFilterBooks : courseList} /> <Books list={gradeFilterBooks ? gradeFilterBooks : courseList} theme={theme} />
<Blogs /> <Blogs theme={theme} />
<AppDownload /> <AppDownload />
<Footer /> <Footer theme={theme} />
</div> </div>
{vocal ? ( {vocal ? (
<Vocal setVocal={setVocal} setInputValue={setInputValue} /> <Vocal setVocal={setVocal} setInputValue={setInputValue} />
@ -96,6 +100,7 @@ export default connect(
headerData: state.publicApi.header, headerData: state.publicApi.header,
bookLoading: state.book.loading, bookLoading: state.book.loading,
publicLoading: state.publicApi.loading, publicLoading: state.publicApi.loading,
theme : state.publicApi.theme,
}), }),
{ {
getCourseList: book.list, getCourseList: book.list,

Loading…
Cancel
Save