Skip to content

Commit f666cbf

Browse files
author
Programming-Sai
committed
Making minor adjustments
1 parent 3e0a1e9 commit f666cbf

File tree

15 files changed

+1030
-693
lines changed

15 files changed

+1030
-693
lines changed

src/app/admin/editor/page.jsx

+10-10
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ const debounce = (func, delay) => {
5656

5757
const Editor = () => {
5858
const extractTextFromBlog = (content) => {
59-
// Use the parser to convert HTML to a React node, then extract the text
60-
const parsedContent = parse(content);
61-
if (typeof parsedContent === "string") {
62-
return parsedContent.replace(/\n/g, " ");
59+
// Check if the code is running in a browser environment
60+
if (typeof window !== "undefined") {
61+
// Create a new DOMParser instance
62+
const parser = new DOMParser();
63+
const doc = parser.parseFromString(content, "text/html");
64+
65+
// Extract the text content from the parsed document
66+
return doc.body.textContent || "";
6367
}
6468

65-
return parsedContent.props.children
66-
.map((child) =>
67-
typeof child === "string" ? child : child.props.children
68-
)
69-
.join(" ")
70-
.replace(/\n/g, " ");
69+
// Return an empty string or handle the case where it's not in a browser
70+
return "";
7171
};
7272

7373
const {

src/components/aboutherosection/AboutHeroSection.jsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
import React from "react";
22
import styles from "./aboutherosection.module.css";
3+
import BASE_PATH from "../../../base";
34

45
const AboutHeroSection = () => {
56
return (
67
<div className={styles.container}>
78
<div
8-
style={{ "--img": `url("/food.png")` }}
9+
style={{ "--img": `url("${BASE_PATH}/food.png")` }}
910
className={`${styles.item} ${styles.S}`}
1011
/>
1112
<div
12-
style={{ "--img": `url("/fashion.png")` }}
13+
style={{ "--img": `url("${BASE_PATH}/fashion.png")` }}
1314
className={`${styles.item} ${styles.N}`}
1415
/>
1516
<div
16-
style={{ "--img": `url("/travel.png")` }}
17+
style={{ "--img": `url("${BASE_PATH}/travel.png")` }}
1718
className={`${styles.item} ${styles.L}`}
1819
/>
1920
<div
20-
style={{ "--img": `url("/style.png")` }}
21+
style={{ "--img": `url("${BASE_PATH}/style.png")` }}
2122
className={`${styles.item} ${styles.M}`}
2223
/>
2324
<div
24-
style={{ "--img": `url("/culture.png")` }}
25+
style={{ "--img": `url("${BASE_PATH}/culture.png")` }}
2526
className={`${styles.item} ${styles.U}`}
2627
/>
2728
</div>

src/components/aboutherosection/aboutherosection.module.css

+42-29
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,48 @@
11
.container {
2-
display: grid;
3-
grid-template-areas:
4-
"S S N"
5-
"L M N"
6-
"L M N"
7-
"L U U";
8-
grid-template-columns: 1fr 1fr 1fr;
9-
grid-template-rows: 200px 150px 150px 200px;
10-
gap: 10px;
11-
margin-block: 5%;
2+
display: grid;
3+
grid-template-areas:
4+
"S S N"
5+
"L M N"
6+
"L M N"
7+
"L U U";
8+
grid-template-columns: 1fr 1fr 1fr;
9+
grid-template-rows: 200px 150px 150px 200px;
10+
gap: 10px;
11+
margin-block: 5%;
12+
opacity: 0.6;
1213
}
1314

14-
.S { grid-area: S; background: var(--img); }
15-
.N { grid-area: N; background: var(--img); }
16-
.L { grid-area: L; background: var(--img); }
17-
.M { grid-area: M; background: var(--img); }
18-
.U { grid-area: U; background: var(--img); }
19-
20-
15+
.S {
16+
grid-area: S;
17+
background: var(--img);
18+
}
19+
.N {
20+
grid-area: N;
21+
background: var(--img);
22+
}
23+
.L {
24+
grid-area: L;
25+
background: var(--img);
26+
}
27+
.M {
28+
grid-area: M;
29+
background: var(--img);
30+
}
31+
.U {
32+
grid-area: U;
33+
background: var(--img);
34+
}
2135

2236
.item {
23-
background-size: cover;
24-
background-position: center;
25-
position: relative;
26-
color: white;
27-
display: flex;
28-
align-items: center;
29-
justify-content: center;
30-
font-size: 1.5em;
31-
text-align: center;
32-
padding: 20px;
33-
border-radius: 20px;
37+
background-size: cover;
38+
background-position: center;
39+
position: relative;
40+
color: white;
41+
display: flex;
42+
align-items: center;
43+
justify-content: center;
44+
font-size: 1.5em;
45+
text-align: center;
46+
padding: 20px;
47+
border-radius: 20px;
3448
}
35-
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,149 @@
1-
'use client'
2-
import React, { useState, useEffect } from 'react'
3-
import styles from './adminrecentpost.module.css'
4-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
5-
import { faBarChart, faClock, faComment, faEye, faGear, faPencil, faShare } from '@fortawesome/free-solid-svg-icons'
1+
"use client";
2+
import React, { useState, useEffect } from "react";
3+
import styles from "./adminrecentpost.module.css";
4+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
5+
import {
6+
faBarChart,
7+
faClock,
8+
faComment,
9+
faEye,
10+
faGear,
11+
faPencil,
12+
faShare,
13+
} from "@fortawesome/free-solid-svg-icons";
14+
import BASE_PATH from "../../../base";
615

716
const AdminRecentPosts = () => {
8-
917
const sliderData = [
1018
{
11-
img: '/style.png',
12-
title: '20 Best Travel Tips After 5 Years Of Traveling The World',
13-
views: '12K Views',
14-
shares: '234 Shares',
15-
comments: '44 Comments',
16-
released: 'Released 3d ago',
19+
img: "/style.png",
20+
title: "20 Best Travel Tips After 5 Years Of Traveling The World",
21+
views: "12K Views",
22+
shares: "234 Shares",
23+
comments: "44 Comments",
24+
released: "Released 3d ago",
1725
},
1826
{
19-
img: '/coding.png',
20-
title: 'Top 10 Programming Tips for Beginners',
21-
views: '15K Views',
22-
shares: '300 Shares',
23-
comments: '60 Comments',
24-
released: 'Released 2d ago',
27+
img: "/coding.png",
28+
title: "Top 10 Programming Tips for Beginners",
29+
views: "15K Views",
30+
shares: "300 Shares",
31+
comments: "60 Comments",
32+
released: "Released 2d ago",
2533
},
2634
{
27-
img: '/food.png',
28-
title: 'Best Recipes for Home-Cooked Meals in 2024',
29-
views: '18K Views',
30-
shares: '500 Shares',
31-
comments: '120 Comments',
32-
released: 'Released 5d ago',
35+
img: "/food.png",
36+
title: "Best Recipes for Home-Cooked Meals in 2024",
37+
views: "18K Views",
38+
shares: "500 Shares",
39+
comments: "120 Comments",
40+
released: "Released 5d ago",
3341
},
3442
{
35-
img: '/fashion.png',
36-
title: 'Fashion Trends to Watch in 2024',
37-
views: '9K Views',
38-
shares: '150 Shares',
39-
comments: '30 Comments',
40-
released: 'Released 1w ago',
43+
img: "/fashion.png",
44+
title: "Fashion Trends to Watch in 2024",
45+
views: "9K Views",
46+
shares: "150 Shares",
47+
comments: "30 Comments",
48+
released: "Released 1w ago",
4149
},
4250
{
43-
img: '/travel.png',
44-
title: 'Hidden Travel Gems Around the World You Must Visit',
45-
views: '20K Views',
46-
shares: '450 Shares',
47-
comments: '80 Comments',
48-
released: 'Released 1d ago',
51+
img: "/travel.png",
52+
title: "Hidden Travel Gems Around the World You Must Visit",
53+
views: "20K Views",
54+
shares: "450 Shares",
55+
comments: "80 Comments",
56+
released: "Released 1d ago",
4957
},
5058
{
51-
img: '/culture.png',
52-
title: 'Understanding Global Cultures: A Guide for 2024',
53-
views: '22K Views',
54-
shares: '600 Shares',
55-
comments: '140 Comments',
56-
released: 'Released 3h ago',
57-
}
59+
img: "/culture.png",
60+
title: "Understanding Global Cultures: A Guide for 2024",
61+
views: "22K Views",
62+
shares: "600 Shares",
63+
comments: "140 Comments",
64+
released: "Released 3h ago",
65+
},
5866
];
59-
60-
6167

6268
const [currentSlide, setCurrentSlide] = useState(0);
6369
const totalSlides = sliderData.length;
6470

6571
useEffect(() => {
6672
const interval = setInterval(() => {
6773
setCurrentSlide((prevSlide) => (prevSlide + 1) % totalSlides);
68-
if (currentSlide === totalSlides-1){
69-
sliderData.push(sliderData.shift())
74+
if (currentSlide === totalSlides - 1) {
75+
sliderData.push(sliderData.shift());
7076
}
71-
}, 5000);
77+
}, 5000);
7278

73-
return () => clearInterval(interval);
79+
return () => clearInterval(interval);
7480
}, [totalSlides]);
7581

76-
77-
7882
return (
7983
<div className={styles.container}>
8084
<div
8185
className={styles.sliderItems}
8286
style={{ transform: `translateX(-${currentSlide * 100}%)` }}
8387
>
84-
85-
{sliderData.map((item, i) => (
86-
<div className={styles.sliderItem} key={i} style={{ '--img': `url(${item.img})` }}>
87-
<div className={styles.top}>
88-
<div className={styles.itemsContainer}>
89-
<div className={styles.button}>
90-
<FontAwesomeIcon icon={faPencil}/>
91-
</div>
92-
<div className={styles.button}>
93-
<FontAwesomeIcon icon={faGear}/>
94-
</div>
95-
<div className={styles.button}>
96-
<FontAwesomeIcon icon={faBarChart}/>
97-
</div>
88+
{sliderData.map((item, i) => (
89+
<div
90+
className={styles.sliderItem}
91+
key={i}
92+
style={{ "--img": `url(${BASE_PATH}${item.img})` }}
93+
>
94+
<div className={styles.top}>
95+
<div className={styles.itemsContainer}>
96+
<div className={styles.button}>
97+
<FontAwesomeIcon icon={faPencil} />
98+
</div>
99+
<div className={styles.button}>
100+
<FontAwesomeIcon icon={faGear} />
101+
</div>
102+
<div className={styles.button}>
103+
<FontAwesomeIcon icon={faBarChart} />
98104
</div>
99105
</div>
106+
</div>
100107

101-
<div className={styles.textContainer}>
102-
<p>LATEST POSTS</p>
103-
<h4>{item.title}</h4>
104-
<div className={styles.stats}>
105-
<div className={styles.stat}>
106-
<FontAwesomeIcon className={styles.icon} icon={faEye}/>
107-
<p>{item.views}</p>
108-
</div>
109-
<div className={styles.stat}>
110-
<FontAwesomeIcon className={styles.icon} icon={faShare}/>
111-
<p>{item.shares}</p>
112-
</div>
113-
<div className={styles.stat}>
114-
<FontAwesomeIcon className={styles.icon} icon={faComment}/>
115-
<p>{item.comments}</p>
116-
</div>
117-
<div className={styles.stat}>
118-
<FontAwesomeIcon className={styles.icon} icon={faClock}/>
119-
<p>{item.released}</p>
120-
</div>
108+
<div className={styles.textContainer}>
109+
<p>LATEST POSTS</p>
110+
<h4>{item.title}</h4>
111+
<div className={styles.stats}>
112+
<div className={styles.stat}>
113+
<FontAwesomeIcon className={styles.icon} icon={faEye} />
114+
<p>{item.views}</p>
115+
</div>
116+
<div className={styles.stat}>
117+
<FontAwesomeIcon className={styles.icon} icon={faShare} />
118+
<p>{item.shares}</p>
119+
</div>
120+
<div className={styles.stat}>
121+
<FontAwesomeIcon className={styles.icon} icon={faComment} />
122+
<p>{item.comments}</p>
123+
</div>
124+
<div className={styles.stat}>
125+
<FontAwesomeIcon className={styles.icon} icon={faClock} />
126+
<p>{item.released}</p>
121127
</div>
122128
</div>
123129
</div>
124-
))}
130+
</div>
131+
))}
125132
</div>
126-
127-
128-
133+
129134
<div className={styles.dashes}>
130-
{sliderData.map((_, i) => (
131-
<div
132-
key={i}
133-
className={`${styles.dash} ${currentSlide === i ? styles.active : ''}`}
134-
onClick={() => setCurrentSlide(i)}
135-
/>
136-
))}
135+
{sliderData.map((_, i) => (
136+
<div
137+
key={i}
138+
className={`${styles.dash} ${
139+
currentSlide === i ? styles.active : ""
140+
}`}
141+
onClick={() => setCurrentSlide(i)}
142+
/>
143+
))}
137144
</div>
138-
139145
</div>
140-
)
141-
}
146+
);
147+
};
142148

143-
export default AdminRecentPosts
149+
export default AdminRecentPosts;

0 commit comments

Comments
 (0)