From 362324925be36fd3e34d8fb50df68ddc9c1e66ea Mon Sep 17 00:00:00 2001 From: Chukwumdiebube Date: Fri, 20 Jan 2023 16:17:13 +0100 Subject: [PATCH] Worked on the blog single page --- .env | 8 +- src/assets/css/style.css | 132 +++++--- src/component/Blog/Blog/Main.js | 203 +++++++----- src/component/Blog/BlogSingle/Main.js | 456 +++++++++++--------------- src/routes/index.js | 2 +- 5 files changed, 414 insertions(+), 387 deletions(-) diff --git a/.env b/.env index 77a487b..1f305c2 100644 --- a/.env +++ b/.env @@ -5,12 +5,16 @@ REACT_APP_YEAR=2023 REACT_APP_ANDROID_URL="https://play.google.com/store/apps/details?id=com.mermsemr.myfit" REACT_APP_IOS_URL="https://play.google.com/store/apps/details?id=com.mermsemr.myfit" -REACT_APP_FACEBOOK="https://www.facebook.com/profile.php?id=100066498622246" -REACT_APP_TWITTER="https://twitter.com/fluxtra" REACT_APP_APPSITE=" https://myfitapp.mermsemr.com" #REACT_APP_APPSITE="http://localhost:7012" +# Social Media Links +REACT_APP_FACEBOOK="https://www.facebook.com/profile.php?id=100066498622246" +REACT_APP_TWITTER="https://twitter.com/fluxtra" +REACT_APP_INSTAGRAM="" +REACT_APP_PINTEREST="" + REACT_APP_AUX_ENDPOINT = "https://devapi.mermsemr.com/en/desktop/api/v2/myfit" REACT_APP_FORM_TIMEOUT = 10000 diff --git a/src/assets/css/style.css b/src/assets/css/style.css index 1b8caf4..797b3ac 100644 --- a/src/assets/css/style.css +++ b/src/assets/css/style.css @@ -3010,9 +3010,12 @@ header.fix_style.white_header { .blog_detail_section .blog_inner_pannel .review span { line-height: 1; + color: var(--purple); + display: inline-block; + font-weight: 700; } -.blog_detail_section .blog_inner_pannel .review span:first-child { +/* .blog_detail_section .blog_inner_pannel .review span:first-child { color: var(--purple); display: inline-block; font-weight: 700; @@ -3024,7 +3027,7 @@ header.fix_style.white_header { margin-left: 15px; padding-left: 15px; border-left: 1px solid var(--dark-purple); -} +} */ .blog_detail_section .blog_inner_pannel .section_title { margin-bottom: 40px; @@ -3043,29 +3046,29 @@ header.fix_style.white_header { } .blog_detail_section .blog_inner_pannel .info h3 { - font-weight: 700; - color: var(--dark-purple); - margin-top: 30px; - font-size: 25px; - margin-bottom: 15px; + font-weight: 700; + color: var(--dark-purple); + margin-top: 30px; + font-size: 25px; + margin-bottom: 15px; } /* To highlight the link in the terms section */ -.blog_detail_section .blog_inner_pannel .info p span a{ - color: var(--dark-purple); - text-decoration: underline; +.blog_detail_section .blog_inner_pannel .info p span a { + color: var(--dark-purple); + text-decoration: underline; } /* To reduce the fonts for sub-headers */ .blog_detail_section .blog_inner_pannel .info h4 { - font-weight: 700; - color: var(--dark-purple); - margin-top: 30px; - font-size: 20px; - margin-bottom: 15px; - } + font-weight: 700; + color: var(--dark-purple); + margin-top: 30px; + font-size: 20px; + margin-bottom: 15px; +} - /* To align the text for proper readability */ +/* To align the text for proper readability */ .blog_detail_section .blog_inner_pannel .info p { text-align: justify; } @@ -3526,39 +3529,71 @@ header.fix_style.white_header { } /* Textarea scrollbar */ -.contact_page_section .contact_inner .contact_form form .form-group textarea::-webkit-scrollbar { +.contact_page_section + .contact_inner + .contact_form + form + .form-group + textarea::-webkit-scrollbar { width: 12px; cursor: pointer; } -.contact_page_section .contact_inner .contact_form form .form-group textarea::-webkit-scrollbar-track { - -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); +.contact_page_section + .contact_inner + .contact_form + form + .form-group + textarea::-webkit-scrollbar-track { + -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3); border-radius: 10px; background-color: var(--light-bg); } -.contact_page_section .contact_inner .contact_form form .form-group textarea::-webkit-scrollbar-thumb { +.contact_page_section + .contact_inner + .contact_form + form + .form-group + textarea::-webkit-scrollbar-thumb { border-radius: 10px; - -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); + -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5); background-color: var(--body-text-purple); } -.contact_page_section .contact_inner .contact_form form .form-group .contact_btn{ +.contact_page_section + .contact_inner + .contact_form + form + .form-group + .contact_btn { display: flex !important; align-items: center; justify-content: center; } -.contact_page_section .contact_inner .contact_form form .form-group .contact_btn p{ +.contact_page_section + .contact_inner + .contact_form + form + .form-group + .contact_btn + p { margin: 0 !important; } -.contact_page_section .contact_inner .contact_form form .form-group .contact_btn > span{ +.contact_page_section + .contact_inner + .contact_form + form + .form-group + .contact_btn + > span { width: 24px; height: 24px; } -#contact_body{ +#contact_body { min-height: 48rem; display: flex; flex-direction: column; @@ -3567,7 +3602,7 @@ header.fix_style.white_header { gap: 10px; } -.contact_body{ +.contact_body { display: flex; flex-direction: column; align-content: center; @@ -3598,28 +3633,44 @@ header.fix_style.white_header { } /* For the err msg */ -#errText{ +#errText { text-align: center; color: tomato; font-weight: 600; } -.contact_page_section .contact_inner .contact_form form .form-group span{ +.contact_page_section .contact_inner .contact_form form .form-group span { font-size: 12px; color: tomato; padding: 3px; display: none; } -.contact_page_section .contact_inner .contact_form form .form-group input:valid[focused="true"]{ +.contact_page_section + .contact_inner + .contact_form + form + .form-group + input:valid[focused="true"] { border: 1px solid var(--dark-purple); } -.contact_page_section .contact_inner .contact_form form .form-group input:invalid[focused="true"]{ +.contact_page_section + .contact_inner + .contact_form + form + .form-group + input:invalid[focused="true"] { border: 1px solid tomato; } -.contact_page_section .contact_inner .contact_form form .form-group input:invalid[focused="true"] ~ span{ +.contact_page_section + .contact_inner + .contact_form + form + .form-group + input:invalid[focused="true"] + ~ span { display: block; } @@ -4689,19 +4740,20 @@ header.fix_style.white_header { /* Loader */ -.loader{ +.loader { border-radius: 100%; position: relative; } -.loader-sm{ +.loader-sm { width: 24px; height: 24px; } /* LOADER 1 */ -#loader-1:before, #loader-1:after{ +#loader-1:before, +#loader-1:after { content: ""; position: absolute; width: 100%; @@ -4711,24 +4763,24 @@ header.fix_style.white_header { border-top-color: var(--body-text-purple); } -#loader-1:before{ +#loader-1:before { z-index: 100; animation: spin 1.5s infinite; } -#loader-1:after{ +#loader-1:after { border: 3.5px solid #ccc; } -@keyframes spin{ - 0%{ +@keyframes spin { + 0% { -webkit-transform: rotate(0deg); -ms-transform: rotate(0deg); -o-transform: rotate(0deg); transform: rotate(0deg); } - 100%{ + 100% { -webkit-transform: rotate(360deg); -ms-transform: rotate(360deg); -o-transform: rotate(360deg); diff --git a/src/component/Blog/Blog/Main.js b/src/component/Blog/Blog/Main.js index 36d7625..b2e1e87 100644 --- a/src/component/Blog/Blog/Main.js +++ b/src/component/Blog/Blog/Main.js @@ -1,46 +1,72 @@ +/** @format */ + 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 api = new SiteService(); + let api = new SiteService(); useEffect(() => { getBlogData(); }, []); const getBlogData = async () => { - try { - const res = await api.blogData(); + // Saving it locally to avoid interfering with server + if (localStorage.getItem("myFit--blogData") == null) { + try { + let res = await api.blogData(); - setBlogData(res.data); - - console.log(res.data); - - - } catch (error) { - console.log("Error from blog data ", error); + // Set the blog data to local storage + localStorage.setItem("myFit--blogData", JSON.stringify(res.data)); + setBlogData(res.data); + // Set a time out for the blog data to be deleted from local storage + setTimeout(() => { + localStorage.removeItem("myFit--blogData"); + }, 3600); + } catch (error) { + console.log("Error from blog data ", error); + } + } else { + try { + let data = JSON.parse(localStorage.getItem("myFit--blogData")); + setBlogData(data); + } catch (error) { + console.error("Error parsing JSON data: ", error); + } } }; - + return ( <> -
+
{" "} - image{" "} + image{" "} {" "} - image{" "} + image{" "} {" "} - image{" "} + image{" "}
@@ -53,93 +79,118 @@ const Main = ({ brdcum, bgimg }) => { ยป
  • - Blog + + {blogData.map((item, idx) => { + if (idx === 0) { + return {item.post_title}; + } + })} +
  • - {/*
    -
    -
    - - -
    -
    -
    */}
    - {blogData.map((data,index) => { - if (index == 0){ + {blogData.map((data, index) => { + console.log(data) + if (index == 0) { return ( -
    -
    -
    -
    - image - {/* 20 min ago */} - - {new Date (data.post_date).toDateString()} +
    +
    +
    +
    + image + + {new Date(data.post_date).toDateString()} +
    -
    -
    -
    -
    -

    {data.post_title}

    -
    - +
    +
    +
    +

    {data.post_title}

    +
    + {/* Change the route name */} + READ MORE +
    -
    - - ) - } + ); + } })} - -
    -
    + +
    {blogData.map((data, index) => { - if (index > 0){ + if (index > 0) { return ( -
    -
    -
    - image - {new Date (data && data.post_date).toDateString()} +
    +
    +
    + image + + {new Date(data && data.post_date).toDateString()} + +
    +
    +

    {data.post_title}

    +
    + {/* Change the route name */} + + READ MORE + +
    +
    -
    -

    {data.post_title}

    -
    - - READ MORE - -
    -
    -
    - - )} - - - })} + ); + } + })}
    +
    • - + {" "} Visit our blog diff --git a/src/component/Blog/BlogSingle/Main.js b/src/component/Blog/BlogSingle/Main.js index 08a0686..f881a88 100644 --- a/src/component/Blog/BlogSingle/Main.js +++ b/src/component/Blog/BlogSingle/Main.js @@ -1,288 +1,208 @@ +/** @format */ + 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 { 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"; +import SiteService from "../../../vendors/service/siteService"; -const Main = ({brdcum}) => { +const Main = ({ brdcum }) => { + const { id } = useParams(); + const location = useLocation(); + let data = location.state?.data; + const [blogData, setBlogData] = useState([]); + + let api_call = new SiteService(); + useEffect(() => { + getBlogData(); + }, [blogData]); + + const getBlogData = async () => { + // Saving it locally to avoid interfering with server + if (localStorage.getItem("myFit--blogData") == null) { + try { + let res = await api_call.blogData(); + + // Set the blog data to local storage + localStorage.setItem("myFit--blogData", JSON.stringify(res.data)); + setBlogData(res.data); + // Set a time out for the blog data to be deleted from local storage + setTimeout(() => { + localStorage.removeItem("myFit--blogData"); + }, 3600); + } catch (error) { + console.log("Error from blog data ", error); + } + } else { + try { + let data = JSON.parse(localStorage.getItem("myFit--blogData")); + setBlogData(data); + } catch (error) { + console.error("Error parsing JSON data: ", error); + } + } + }; + + console.log("location", location, data); - const { id } = useParams(); - const location = useLocation(); - const data = location.state?.data; - - console.log("location", location, data); - return ( <> - - {brdcum.b1 && - } + {brdcum.b1 && ( + + )} - {brdcum.b2 && - } + {brdcum.b2 && ( + + )} - {brdcum.b5 && - } + {brdcum.b5 && ( + + )} - {brdcum.b3 && - } + {brdcum.b3 && ( + + )} - {brdcum.b4 && - } + {brdcum.b4 && ( + + )} -
      -
      -
      -
      - Review - {/* 45 min ago */} - {new Date (data && data.post_modified).toDateString()} - -
      -
      -

      {data && data.post_title}

      -
      -
      - image -
      -
      -

      {data && data.post_name}

      -
      -
      - {/*
      -

      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.

      -

      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.

      -

      Why we are best

      -

      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 typesetting in

      • -
      • Dustry lorem Ipsum has been the industrys standard dummy text ev er since the when

      • -
      • Unknown printer took a galley of type and scrambled it to make.

      • -
      • 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.

      • -
      • Dustry lorem Ipsum has been the industrys standard dummy text ev er since.

      • -
      • Unknown printer took a galley of type and scrambled it to make.

      • -
      • Type specimen book. It has survived not only.

      • -
      -
      -
      -
      -
      - image -
      -
      - image -
      -
      -
      -
      -

      Why we are best

      -

      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.

      -
      -
      - image -

      Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the industrys standard dummy.

      -

      Mr. John Doe, Apper Inc

      -
      */} - {/*

      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.

      */} -
      -
      - {/*
      - image -
      */} -
      -

      {data && data.post_author}

      - {new Date (data && data.post_date).toDateString()} -
      -
      -
      -
        -
      • -
      • -
      • -
      • -
      -
      -
      -
      -
        -
      • Tags:

      • -
      • app,
      • -
      • rating,
      • -
      • development
      • -
      -
      -
      +
      +
      +
      +
      + {new Date(data && data.post_modified).toDateString()}
      -
      -
      -
      -
      -

      3 Comments

      +
      +

      {data && data.post_title}

      +
      +
      + image +
      +
      +

      {data && data.post_name}

      +
      +
      + +
      +
      +
      + {/*

      {data && data.post_author}

      */} + {new Date(data && data.post_date).toDateString()}
      +
      +
        -
      • -
        -
        - image -
        -
        - 30 min ago -

        Dolly Shell

        -
        -
        -
        -

        Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the in - dustrys 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.

        -
        -
      • -
      • -
        -
        - image -
        -
        - 15 min ago -

        Devil Joe

        -
        -
        -
        -

        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 when.

        -
        -
      • -
      • -
        -
        - image -
        -
        - 2 days ago -

        Sherly Shie

        -
        -
        -
        -

        Lorem Ipsum is simply dummy text of the printing and typesetting in dustry lorem Ipsum has been the in - dustrys 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.

        -
        -
      • +
      • + + + +
      • +
      • + + + +
      • +
      • + + + +
      • +
      • + + + +
      +
      -
      + +
      +
    +
    -
    -
    -
    -

    Leave a comment

    -

    Your email address will not be published. Required fields are marked *

    +
    +
    + {/* Latest Title */} +
    +

    + Read latest story +


    +
    + {/* Body */} +
    + {blogData.slice(-4, -1).map((item, index) => ( +
    +
    +
    + image + {new Date(item.post_date).toDateString()} +
    +
    +

    {item.post_title}

    +
    + READ MORE +
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -

    Read latest story

    -

    Lorem Ipsum is simply dummy text of the printing and typese tting
    indus orem Ipsum has beenthe standard dummy.

    -
    -
    -
    -
    -
    - image - 45 min ago -
    -
    -

    Cool features added!

    -

    Lorem Ipsum is simply dummy text of the printing and typesetting - industry lorem Ipsum has.

    - READ MORE -
    -
    -
    -
    -
    -
    - image - 45 min ago -
    -
    -

    Top rated app! Yupp.

    -

    Simply dummy text of the printing and typesetting industry lorem Ipsum has Lorem Ipsum is.

    - READ MORE -
    -
    -
    -
    -
    -
    - image - 45 min ago -
    -
    -

    Creative ideas on app.

    -

    Printing and typesetting industry lorem Ipsum has Lorem simply dummy text of the.

    - READ MORE -
    -
    -
    -
    -
    -
    +
    + ))} +
    +
    + - ) -} + ); +}; -export default Main \ No newline at end of file +export default Main; diff --git a/src/routes/index.js b/src/routes/index.js index af34beb..8aee054 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -84,7 +84,7 @@ const Routing = () => { } /> } /> } /> - } /> + } /> } /> } />