reza added some thing

master
Reza_ashrafi 3 years ago
parent caba2fa0ad
commit d2cd387411
  1. 6
      src/redux/actions-type/public.tsx
  2. 4
      src/redux/actions/public.tsx
  3. 3
      src/redux/reducers/public.tsx
  4. 2
      src/views/Home/Books/Book/index.scss
  5. 2
      src/views/Home/Courses/Course/index.scss
  6. 71
      src/views/Home/Header/Item/index.scss
  7. 25
      src/views/Home/Header/Item/index.tsx
  8. 18
      src/views/Home/Header/index.tsx
  9. 39
      src/views/Home/index.tsx

@ -43,6 +43,11 @@ interface selectMenu {
data: any; data: any;
} }
interface getHeader{
type: "public/homePageVOD";
data: any;
}
interface error { interface error {
type: "error"; type: "error";
data: undefined; data: undefined;
@ -67,6 +72,7 @@ type PublicAction =
| getCity | getCity
| getContactData | getContactData
| selectMenu | selectMenu
| getHeader
| loading | loading
| error; | error;

@ -29,6 +29,10 @@ const publicApi = {
await proxy.get("public/city", data, { dispatch }), await proxy.get("public/city", data, { dispatch }),
selectMenu: (data: Object) => async (dispatch: Dispatch) => selectMenu: (data: Object) => async (dispatch: Dispatch) =>
await dispatch({ type: "public/selectMenu", data: data }), await dispatch({ type: "public/selectMenu", data: data }),
getHeader:
(data = {}) =>
async (dispatch: Dispatch) =>
await proxy.get("public/homePageVOD", data, { dispatch }),
}; };
export default publicApi; export default publicApi;

@ -26,6 +26,7 @@ const initialState = {
name: "برنامه نویسی", name: "برنامه نویسی",
}, },
], ],
header : [],
selectedMenu : null, selectedMenu : null,
contactData: null contactData: null
}; };
@ -175,6 +176,8 @@ export default function publicApi(state = initialState, action: PublicAction) {
return { ...state, loading: false, error: null, city: data }; return { ...state, loading: false, error: null, city: data };
case "public/selectMenu": case "public/selectMenu":
return { ...state, loading: false, error: null, selectedMenu : data }; return { ...state, loading: false, error: null, selectedMenu : data };
case "public/homePageVOD":
return { ...state, loading: false, error: null, header : data };
case "loading": case "loading":
return { ...state, loading: true }; return { ...state, loading: true };
case "error": case "error":

@ -37,7 +37,7 @@
.home-books-book{ .home-books-book{
&:hover{ &:hover{
transform : scale(0.95); transform : scale(0.95);
border: 1px solid #84de56; background-color: #86868628;
} }
img{ img{
height: 300px; height: 300px;

@ -36,7 +36,7 @@
@media screen and (min-width : 1441px){ @media screen and (min-width : 1441px){
.home-courses-course{ .home-courses-course{
&:hover{ &:hover{
border: 1px solid #84de56; background-color: #86868628;
transform: scale(0.95); transform: scale(0.95);
} }
img{ img{

@ -1,71 +0,0 @@
.home-header-item{
width: 100%;
color: white;
font-family: numeralLight;
border-radius: 10px;
}
@media screen and (min-width: 1441px){
.home-header-item{
max-width: 1250px;
height: 400px;
div{
width: 29%;
h1{
font-family: numeralMedium;
font-size: 24px;
}
h2{
font-size: 20px;
}
p{
margin-top: 20px;
font-size: 16px;
}
}
}
}
@media screen and (min-width: 1008px) and (max-width: 1440px) {
.home-header-item{
max-width: 1250px;
height: 400px;
div{
width: 31%;
h1{
font-family: numeralBold;
font-size: calc(100vw / 60);
}
h2{
font-size: calc(100vw / 70);
font-family: numeralMedium;
}
p{
margin-top: 20px;
font-size:calc(100vw / 90);
}
}
}
}
@media screen and (min-width: 640px) and (max-width: 1007px) {
.home-header-item{
max-width: 900px;
height: 235px;
div{
width: 31%;
h1{
font-family: numeralBold;
font-size: calc(100vw / 50);
}
h2{
font-size: calc(100vw / 60);
}
p{
margin-top: 20px;
font-size: calc(100vw / 70);
}
}
}
}

@ -1,25 +0,0 @@
import React from "react";
import './index.scss';
export default function Item(props: any) {
const { data } = props;
const style = {
background: `url(${data.imageUrl})`,
backgroundSize : '100% 100%',
backgroundRepeat : 'no-repeat',
backgroundAttachment : 'fixed',
backgroundPosition: '0px 0px',
};
return (
<div
className="home-header-item d-flex justify-content-end align-items-center"
style={style}
>
<div>
<h1>{data.name}</h1>
<h2>{data.subTitle}</h2>
<p>{data.text}</p>
</div>
</div>
);
}

@ -8,24 +8,26 @@ export default function Header(props: any) {
<header className="home-header"> <header className="home-header">
<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: Number) => ( {headerData.map((item: any, i: any) => (
<div <div
className={item.id === 0 ? "item active" : "item"} className={i === 0 ? "item active" : "item"}
style={{ style={{
background: `url(${item.imageUrl})`, background: `url(${"https://dnvn.ir/api/v1/file/"+ item.fileId})`,
}} }}
// dataBackgroundImage={`https://dnvn.ir/api/v1/file/${item.fileId}`}
key={i}
> >
<div className="home-header__cover"></div> <div className="home-header__cover"></div>
<div className="home-header__info d-flex flex-column"> <div className="home-header__info d-flex flex-column">
<div className="home-header__info--author d-flex"> <div className="home-header__info--author d-flex">
<Avatar src={item.authorImage} /> <Avatar src={item.authorImage} />
<div className="d-flex flex-column"> <div className="d-flex flex-column">
<h3>{item.author}</h3> <h3>{item.extraText}</h3>
<i>نویسنده</i> <i>نویسنده</i>
</div> </div>
</div> </div>
<h1>{'0' + (item.id + 1)}</h1> <h1>{"0" + (Number(i) + 1)}</h1>
<h1>{item.name}</h1> <h1>{item.title}</h1>
<h2>{item.subTitle}</h2> <h2>{item.subTitle}</h2>
</div> </div>
</div> </div>
@ -41,8 +43,8 @@ export default function Header(props: any) {
> >
<span className={i === 0 ? "active" : ""}></span> <span className={i === 0 ? "active" : ""}></span>
<div className="d-flex flex-column"> <div className="d-flex flex-column">
<b>0{item1.id + 1}</b> <b>{"0" + (Number(i) + 1)}</b>
<strong>{item1.name}</strong> <strong>{item1.title}</strong>
</div> </div>
</li> </li>
))} ))}

@ -12,7 +12,7 @@ import AppDownload from "./AppDownload/index";
import Vocal from "../../components/Vocal/Vocal"; import Vocal from "../../components/Vocal/Vocal";
import scroll from "../../util/scroll"; import scroll from "../../util/scroll";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { book } from "../../redux/actions"; import { book, publicApi } from "../../redux/actions";
import olum7 from "../../assets/images/olum7.jpg"; import olum7 from "../../assets/images/olum7.jpg";
import olum8 from "../../assets/images/olum8.jpg"; import olum8 from "../../assets/images/olum8.jpg";
@ -31,7 +31,8 @@ function Home({
gradeFilterBooks, gradeFilterBooks,
sortFilterCourse, sortFilterCourse,
selectedSort, selectedSort,
sortFilter sortFilter,
getHeader,
}: any) { }: any) {
const [grade, setGrade] = useState(null); const [grade, setGrade] = useState(null);
const [vocal, setVocal] = useState(false); const [vocal, setVocal] = useState(false);
@ -46,6 +47,7 @@ function Home({
useEffect(() => { useEffect(() => {
getCourseList(); getCourseList();
scroll.goToTop(); scroll.goToTop();
getHeader({device : 1});
}, []); }, []);
return ( return (
<> <>
@ -82,8 +84,13 @@ export default connect(
gradeFilterBooks: state.book.gradeFilterBooks, gradeFilterBooks: state.book.gradeFilterBooks,
sortFilterCourse: state.book.sortFilterCourse, sortFilterCourse: state.book.sortFilterCourse,
selectedSort: state.book.selectedSort, selectedSort: state.book.selectedSort,
headerData: state.publicApi.header,
}), }),
{ getCourseList: book.list, sortFilter: book.sortFilter } {
getCourseList: book.list,
sortFilter: book.sortFilter,
getHeader: publicApi.getHeader,
}
)(Home); )(Home);
Home.defaultProps = { Home.defaultProps = {
grades: [ grades: [
@ -136,30 +143,4 @@ Home.defaultProps = {
value: 12, value: 12,
}, },
], ],
headerData: [
{
id: 0,
name: "آیا هیجان زندگی همچنان باقی است؟",
subTitle: "سوالاتی که پاسخی برای آنها نیست!",
text: "آیا ذهن نویسنده به این سمت رفته که شما این متن را بخوانید؟ نویسنده درست حدس زده شما در حال خواندن هستید. لطفا خواندن را تمام کنید ",
author: "جورج جونیور",
imageUrl: header,
},
{
id: 1,
name: "آیا هیجان زندگی همچنان باقی است؟",
subTitle: "سوالاتی که پاسخی برای آنها نیست!",
text: "آیا ذهن نویسنده به این سمت رفته که شما این متن را بخوانید؟ نویسنده درست حدس زده شما در حال خواندن هستید. لطفا خواندن را تمام کنید ",
author: "جورج جونیور",
imageUrl: header,
},
{
id: 2,
name: "آیا هیجان زندگی همچنان باقی است؟",
subTitle: "سوالاتی که پاسخی برای آنها نیست!",
text: "آیا ذهن نویسنده به این سمت رفته که شما این متن را بخوانید؟ نویسنده درست حدس زده شما در حال خواندن هستید. لطفا خواندن را تمام کنید ",
author: "جورج جونیور",
imageUrl: header,
},
],
}; };

Loading…
Cancel
Save