Reza_ashrafi 2 years ago
commit 8bfdaba083
  1. 16
      src/views/Blog/index.js
  2. 28
      src/views/Blogs/layouts/New.js
  3. 21
      src/views/Blogs/layouts/Single.js

@ -50,8 +50,16 @@ export const Blog = ({
<div className="w-full flex justify-between"> <div className="w-full flex justify-between">
<div className="flex"> <div className="flex">
<Avatar size={40} /> <Avatar size={40} />
{/* {!blog?.author.picFileId && <Avatar size={40} />}
{blog?.author.picFileId && (
<img
src={`https://dnvn.ir/api/v1/file/${blog?.author.picFileId}`}
alt="author"
className="w-20 rounded"
/>
)} */}
<div className="flex flex-col py-2 mr-2 justify-center"> <div className="flex flex-col py-2 mr-2 justify-center">
<strong className="text-gray-300 text-tiny font-bold"> <strong className="text-gray-300 text-tiny font-bold bg-red-400 p-2">
{window.t("نوشته از:" + " " + "کامران ایزدی")} {window.t("نوشته از:" + " " + "کامران ایزدی")}
</strong> </strong>
<p className="text-gray-300 mt-2 text-xs"> <p className="text-gray-300 mt-2 text-xs">
@ -159,9 +167,9 @@ export const Blog = ({
</div> </div>
{/* desktop */} {/* desktop */}
</div> </div>
) : <div className="w-full h-screen"> ) : (
<div className="w-full h-screen"></div>
</div>; );
}; };
const mapStateToProps = (state) => ({ const mapStateToProps = (state) => ({

@ -3,6 +3,7 @@ import { connect } from "react-redux";
import { blog } from "../../../redux/actions"; import { blog } from "../../../redux/actions";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import Avatar from "../../../components/Avatar"; import Avatar from "../../../components/Avatar";
import moment from "jalali-moment";
export const New = ({ blog, isMobile, setActive }) => { export const New = ({ blog, isMobile, setActive }) => {
return ( return (
@ -26,29 +27,36 @@ export const New = ({ blog, isMobile, setActive }) => {
<strong className="text-base lg:text-lg lg:my-4 my-2 leading-6 lg:leading-7 dark:text-gray-200"> <strong className="text-base lg:text-lg lg:my-4 my-2 leading-6 lg:leading-7 dark:text-gray-200">
{blog?.title} {blog?.title}
</strong> </strong>
<p className="text-tiny leading-5 lg:leading-6 mb-3 dark:text-gray-200">
{window.t( <div
"هر نفسی که فرو می بریم، مرگی را که مدام به ما دست اندازی میکند پس میزند در نهایت این مرگ" className="text-tiny leading-5 lg:leading-7 mb-3 dark:text-gray-200 p-2 text-justify"
)} dangerouslySetInnerHTML={{ __html: blog?.text }}
</p> />
<div className="w-full hidden lg;flex justify-between"> <div className="w-full hidden lg;flex justify-between">
<div className="flex"> <div className="flex">
<Avatar size={60} /> {!blog?.author.picFileId && <Avatar size={60} />}
{blog?.author.picFileId && (
<img
src={`https://dnvn.ir/api/v1/file${blog?.author.picFileId}`}
alt="author"
className="w-20 rounded"
/>
)}
<div className="flex flex-col py-2 mr-2 justify-center"> <div className="flex flex-col py-2 mr-2 justify-center">
<strong className="lg:text-tiny lg:font-black text-gray1"> <strong className="lg:text-tiny lg:font-black text-gray1">
{`{window.t("نوشته از:")}` + " " + `{window.t("کامران ایزدی")}`} {`{window.t("نوشته از:")}` + " " + `${blog?.author.name}`}
</strong> </strong>
<p className="lg:text-sm lg:font-semibold text-gray70 mt-2"> <p className="lg:text-sm lg:font-semibold text-gray70 mt-2">
{window.t("سردبیر بخش وبلاگ دانوین")} {blog?.author.role}
</p> </p>
</div> </div>
</div> </div>
<div className="flex flex-col i justify-center items-end"> <div className="flex flex-col i justify-center items-end">
<span className="lg:text-sm text-gray1 lg:font-black"> <span className="lg:text-sm text-gray1 lg:font-black">
{`{window.t("زمان مطالعه")}` + " " + `{window.t("۳۰ دقیقه")}`} {`{window.t("زمان مطالعه")}` + " " + `${blog?.duration}`}
</span> </span>
<span className="mt-2 lg:text-sm text-gray1 lg:font-black"> <span className="mt-2 lg:text-sm text-gray1 lg:font-black">
{window.t("1400/11/24")} {moment(blog?.updatedAt).locale("fa").format("YYYY/MM/DD")}
</span> </span>
</div> </div>
</div> </div>

@ -25,22 +25,31 @@ export const Single = ({ blog, isMobile }) => {
<div className="flex flex-col justify-end bg-gradient-to-t from-black lg:hidden absolute top-0 left-0 z-10 w-full h-full pb-2 px-2"> <div className="flex flex-col justify-end bg-gradient-to-t from-black lg:hidden absolute top-0 left-0 z-10 w-full h-full pb-2 px-2">
<div className="w-full flex justify-between"> <div className="w-full flex justify-between">
<div className="flex"> <div className="flex">
<Avatar size={40} /> {!blog?.author.picFileId && <Avatar size={40} />}
{blog?.author.picFileId && (
<img
alt="author"
className="w-20 rounded"
src={`https://dnvn.ir/api/v1/file/${blog?.author.picFileId}`}
/>
)}
<div className="flex flex-col py-2 mr-2 justify-center"> <div className="flex flex-col py-2 mr-2 justify-center">
<strong className="text-gray-300 text-tiny font-bold"> <strong className="text-gray-300 text-tiny font-bold">
{window.t("نوشته از:")} {window.t("نوشته از:")}
</strong> </strong>
<p className="text-gray-300 mt-2 text-xs"> <p className="text-gray-300 mt-2 text-xs">
{window.t("سردبیر بخش وبلاگ دانوین ایزدی")} {blog?.author.name}
</p> </p>
</div> </div>
</div> </div>
<div className="flex flex-col justify-center items-end"> <div className="flex flex-col justify-center items-end gap-y-1">
<span className="text-gray-300 text-sm"> <span className="text-gray-300 text-sm">
{window.t("زمان مطالعه" + " " + "۳۰ دقیقه")} {window.t(
"زمان مطالعه" + " " + `${blog?.duration}` + " " + "دقیقه"
)}
</span> </span>
<span className="mt-2 text-gray-300 text-sm font-bold"> <span className="mt-2 text-gray-300 text-sm font-bold">
{window.t("1400/11/24")} {moment(blog?.updatedAt).locale("fa").format("YYYY/MM/DD")}
</span> </span>
</div> </div>
</div> </div>
@ -60,7 +69,7 @@ export const Single = ({ blog, isMobile }) => {
{!isMobile && ( {!isMobile && (
<div className="w-full flex justify-between"> <div className="w-full flex justify-between">
<div className="flex"> <div className="flex">
{!blog?.author.picFileId && <Avatar size={80} />} {!blog?.author.picFileId && <Avatar size={40} />}
{blog?.author.picFileId && ( {blog?.author.picFileId && (
<img <img
src={`https://dnvn.ir/api/v1/file/${blog?.author.picFileId}`} src={`https://dnvn.ir/api/v1/file/${blog?.author.picFileId}`}

Loading…
Cancel
Save