Compare commits

...

1 Commits

Author SHA1 Message Date
DESKTOP-QHP1O2H\MIKE ec2eb6df31 made changes for blog api data 2023-01-16 02:54:34 -08:00
4 changed files with 165 additions and 151 deletions
+136 -135
View File
@@ -1,27 +1,62 @@
import React from 'react'
import { Link } from 'react-router-dom'
import BGImg from "../../../assets/images/bread_crumb_bg.png"
import BGImg1 from "../../../assets/images/bread_crumb_bg_one.png"
import BGImg2 from "../../../assets/images/bread_crumb_bg_two.png"
import React, { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import BGImg from "../../../assets/images/bread_crumb_bg.png";
import BGImg1 from "../../../assets/images/bread_crumb_bg_one.png";
import BGImg2 from "../../../assets/images/bread_crumb_bg_two.png";
import SiteService from "../../../vendors/service/siteService";
const Main = ({ brdcum, bgimg }) => {
const [blogData, setBlogData] = useState([]);
const Main = ({brdcum,bgimg}) => {
const api = new SiteService();
useEffect(() => {
getBlogData();
}, []);
const getBlogData = async () => {
try {
const res = await api.blogData();
setBlogData(res.data);
console.log(res.data);
} catch (error) {
console.log("Error from blog data ", error);
}
};
return (
<>
<div className="bred_crumb" style={{ backgroundImage : `url(${BGImg})`}}>
<div className="container">
<span className="banner_shape1"> <img src="assets/images/banner-shape1.png" alt="image" /> </span>
<span className="banner_shape2"> <img src="assets/images/banner-shape2.png" alt="image" /> </span>
<span className="banner_shape3"> <img src="assets/images/banner-shape3.png" alt="image" /> </span>
<div className="bred_crumb" style={{ backgroundImage: `url(${BGImg})` }}>
<div className="container">
<span className="banner_shape1">
{" "}
<img src="assets/images/banner-shape1.png" alt="image" />{" "}
</span>
<span className="banner_shape2">
{" "}
<img src="assets/images/banner-shape2.png" alt="image" />{" "}
</span>
<span className="banner_shape3">
{" "}
<img src="assets/images/banner-shape3.png" alt="image" />{" "}
</span>
<div className="bred_text">
<h1>Latest Blog Post</h1>
<ul>
<li><Link to="/">Home</Link></li>
<li><span>»</span></li>
<li><Link to="/blog">Blog</Link></li>
</ul>
{/* <div className="search_bar">
<div className="bred_text">
<h1>Latest Blog Post</h1>
<ul>
<li>
<Link to="/">Home</Link>
</li>
<li>
<span>»</span>
</li>
<li>
<Link to="/blog">Blog</Link>
</li>
</ul>
{/* <div className="search_bar">
<form action="">
<div className="form-group">
<input type="text" placeholder="Search here" className="form-control"/>
@@ -29,126 +64,92 @@ const Main = ({brdcum,bgimg}) => {
</div>
</form>
</div>*/}
</div>
</div>
</div>
</div>
</div>
<section className="row_am blog_list_main">
<div className="container">
<div className="row">
<div className="col-lg-6" data-aos="fade-in" data-aos-duration="1500">
<div className="blog_img">
<img src="https://picsum.photos/seed/picsum/505/378" alt="image"/>
<span>20 min ago</span>
</div>
<section className="row_am blog_list_main">
{blogData.map((data,index) => {
if (index == 0){
return (
<div className="container">
<div className="row">
<div
className="col-lg-6"
data-aos="fade-in"
data-aos-duration="1500"
>
<div className="blog_img">
<img
src={data.meta_value}
alt="image"
/>
{/* <span>20 min ago</span> */}
<span>{new Date (data.post_date).toDateString()}</span>
</div>
</div>
<div className="col-lg-6">
<div className="blog_text">
<div className="section_title">
<h2>Top rated app of the year!</h2>
<p>myFit has powerful connectivity, fitness, health, and safety features
Also makes provision Fitness tracking,Workout tracking,Heart rate monitoringscrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic Lorem Ipsum is simply dummy text of the printing and typesetting.</p>
<Link to="/blog-single">READ MORE</Link>
</div>
<div className="blog_text">
<div className="section_title">
<h2>{data.post_title}</h2>
<div dangerouslySetInnerHTML={{__html: data.post_content.substring(0,400)+' . . .'}}></div>
<Link to={`/blog-single/${data.id}`} state={{data}}>
READ MORE
</Link>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<section className="row_am latest_story blog_list_story" id="blog">
<div className="container">
<div className="row">
<div className="col-md-4">
<div className="story_box" data-aos="fade-up" data-aos-duration="1500">
<div className="story_img">
<img src="https://picsum.photos/seed/picsum/505/378" alt="image" />
<span>45 min ago</span>
</div>
<div className="story_text">
<h3>Cool features added!</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting
industry lorem Ipsum has.</p>
<Link to="/blog-single">READ MORE</Link>
</div>
</div>
</div>
<div className="col-md-4">
<div className="story_box" data-aos="fade-up" data-aos-duration="1500">
<div className="story_img">
<img src="https://picsum.photos/seed/picsum/505/378" alt="image" />
<span>45 min ago</span>
</div>
<div className="story_text">
<h3>Top rated app! Yupp.</h3>
<p>Simply dummy text of the printing and typesetting industry lorem Ipsum has Lorem Ipsum is.</p>
<Link to="/blog-single">READ MORE</Link>
</div>
</div>
</div>
<div className="col-md-4">
<div className="story_box" data-aos="fade-up" data-aos-duration="1500">
<div className="story_img">
<img src="https://picsum.photos/seed/picsum/505/378" alt="image"/>
<span>45 min ago</span>
</div>
<div className="story_text">
<h3>Creative ideas on app.</h3>
<p>Printing and typesetting industry lorem Ipsum has Lorem simply dummy text of the.</p>
<Link to="/blog-single">READ MORE</Link>
</div>
</div>
</div>
<div className="col-md-4">
<div className="story_box" data-aos="fade-up" data-aos-duration="1500">
<div className="story_img">
<img src="https://picsum.photos/seed/picsum/505/378" alt="image"/>
<span>45 min ago</span>
</div>
<div className="story_text">
<h3>Excellence UI design</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting
industry lorem Ipsum has.</p>
<Link to="/blog-single">READ MORE</Link>
</div>
</div>
</div>
<div className="col-md-4">
<div className="story_box" data-aos="fade-up" data-aos-duration="1500">
<div className="story_img">
<img src="https://picsum.photos/seed/picsum/505/378" alt="image"/>
<span>45 min ago</span>
</div>
<div className="story_text">
<h3>Quick and easy Search</h3>
<p>Simply dummy text of the printing and typesetting industry lorem Ipsum has Lorem Ipsum is.</p>
<Link to="/blog-single">READ MORE</Link>
</div>
</div>
</div>
<div className="col-md-4">
<div className="story_box" data-aos="fade-up" data-aos-duration="1500">
<div className="story_img">
<img src="https://picsum.photos/seed/picsum/505/378" alt="image"/>
<span>45 min ago</span>
</div>
<div className="story_text">
<h3>Chat function eded</h3>
<p>Printing and typesetting industry lorem Ipsum has Lorem simply dummy text of the.</p>
<Link to="/blog-single">READ MORE</Link>
</div>
</div>
</div>
</div>
<div className="pagination_block">
<ul>
<li><Link to="#" className="prev"> Visit our blog</Link></li>
</ul>
</div>
</div>
</section>
</>
)
}
export default Main
)
}
})}
</section>
<section className="row_am latest_story blog_list_story" id="blog">
<div className="container">
<div className="row">
{blogData.map((data, index) => {
if (index > 0){
return (
<div key={data.id} className="col-md-4">
<div className="story_box" data-aos="fade-up" data-aos-duration="1500">
<div className="story_img">
<img src={data.meta_value} alt="image" />
<span>{new Date (data && data.post_date).toDateString()}</span>
</div>
<div className="story_text">
<h3>{data.post_title}</h3>
<div dangerouslySetInnerHTML={{__html: data && data.post_content.substring(0,100)+' . . .'}}></div>
<Link to={`/blog-single/${data.id}`} state={{data}}>
READ MORE
</Link>
</div>
</div>
</div>
)}
})}
</div>
<div className="pagination_block">
<ul>
<li>
<Link to="#" className="prev">
{" "}
Visit our blog
</Link>
</li>
</ul>
</div>
</div>
</section>
</>
);
};
export default Main;
+27 -14
View File
@@ -1,11 +1,18 @@
import React from 'react'
import { Link } from 'react-router-dom'
import React, { useEffect, useState } from "react";
import { Link, useLocation } from 'react-router-dom'
import Bredcrumb from '../../Bredcrumb/Main'
import BGImg from "../../../assets/images/bread_crumb_bg.png"
import BGImg1 from "../../../assets/images/bread_crumb_bg_one.png"
import BGImg2 from "../../../assets/images/bread_crumb_bg_two.png"
import { useParams } from "react-router-dom";
const Main = ({brdcum}) => {
const { id } = useParams();
const location = useLocation();
const data = location.state?.data;
console.log("location", location, data);
return (
<>
@@ -49,15 +56,21 @@ const Main = ({brdcum}) => {
<div className="blog_inner_pannel">
<div className="review">
<span>Review</span>
<span>45 min ago</span>
{/* <span>45 min ago</span> */}
<span>{new Date (data && data.post_modified).toDateString()}</span>
</div>
<div className="section_title">
<h2>Top rated app of the year!</h2>
<h2>{data && data.post_title}</h2>
</div>
<div className="main_img">
<img src="assets/images/blog_detail_main.png" alt="image" />
<img src={data && data.meta_value} alt="image" />
</div>
<div className="info">
<h3>{data && data.post_name}</h3>
<div dangerouslySetInnerHTML={{__html: data && data.post_content}}></div>
</div>
{/* <div className="info">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the industrys standard dummy text ev er since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic Lorem Ipsum is simply dummy text of the printing and typesettingindustry lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived.</p>
<p>Printing and typesetting in dustry lorem Ipsum has been the industrys standard dummy text ev er since the 1500s, when an unnown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic Lorem Ipsum is simply dummy text of the printing and typesettingindustry lorem Ipsum has been the industrys centuries, but also the leap into electronic.</p>
<h3>Why we are best</h3>
@@ -72,7 +85,7 @@ const Main = ({brdcum}) => {
<li><p> <span className="icon"><i className="icofont-check-circled"></i></span> Unknown printer took a galley of type and scrambled it to make.</p></li>
<li><p> <span className="icon"><i className="icofont-check-circled"></i></span> Type specimen book. It has survived not only.</p></li>
</ul>
</div>
</div>
<div className="two_img">
<div className="row">
<div className="col-md-6">
@@ -86,21 +99,21 @@ const Main = ({brdcum}) => {
<div className="info">
<h3>Why we are best</h3>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the industrys standard dummy text ev er since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic Lorem Ipsum is simply dummy text of the printing and typesettingindustry lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived.</p>
</div>
<div className="quote_block">
</div>
<div className="quote_block">
<span className="q_icon"><img src="assets/images/quote_icon.png" alt="image" /></span>
<h2>Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the industrys standard dummy.</h2>
<p><span className="name">Mr. John Doe,</span> Apper Inc</p>
</div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the industrys standard dummy text ev er since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic industry.</p>
</div> */}
{/* <p>Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the industrys standard dummy text ev er since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic industry.</p> */}
<div className="blog_authore">
<div className="authore_info">
<div className="avtar">
{/* <div className="avtar">
<img src="assets/images/blog_d02.png" alt="image" />
</div>
</div> */}
<div className="text">
<h3>By: John Dow</h3>
<span>July 25, 2022</span>
<h3>{data && data.post_author}</h3>
<span>{new Date (data && data.post_date).toDateString()}</span>
</div>
</div>
<div className="social_media">
+1 -1
View File
@@ -84,7 +84,7 @@ const Routing = () => {
<Route path="/sign-up" element={<SignUp />} />
<Route path="/pricing" element={<Pricing brdcum={brdcum} />} />
<Route path="/blog" element={<Blog brdcum={brdcum} />} />
<Route path="/blog-single" element={<BlogSingle brdcum={brdcum} />} />
<Route path="/blog-single/:id" element={<BlogSingle brdcum={brdcum} />} />
<Route path="/terms" element={<Terms brdcum={brdcum} />} />
<Route path="/privacy" element={<Privacy brdcum={brdcum} />} />
</Routes>
+1 -1
View File
@@ -7,7 +7,7 @@ class SiteService {
}
// Blog Data {Get}
blogData() {
return this.getAuxEnd("blogdata", null);
return this.getAuxEnd("/blogdata", null);
}
// Country Data {GET}