From 45427a679b74b1315820683801dea18d8bbe346d Mon Sep 17 00:00:00 2001
From: atepem <57289722+atepem@users.noreply.github.com>
Date: Fri, 29 Nov 2024 17:07:39 +0000
Subject: [PATCH] chore: changing up var names
---
common-util/formatDate.js | 2 +-
common-util/useFetchApi.js | 6 ++++--
components/Content/Article.jsx | 14 +++++++++-----
components/HomepageSection/Media.jsx | 8 ++++----
4 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/common-util/formatDate.js b/common-util/formatDate.js
index 7a86c7f..c9dbc03 100644
--- a/common-util/formatDate.js
+++ b/common-util/formatDate.js
@@ -2,7 +2,7 @@ export const formatDate = (date) => {
const newDate = new Date(date);
const options = {
day: '2-digit',
- month: 'long',
+ month: 'short',
year: '2-digit',
};
const formattedDate = newDate.toLocaleDateString('en-GB', options);
diff --git a/common-util/useFetchApi.js b/common-util/useFetchApi.js
index 131c511..0d63abe 100644
--- a/common-util/useFetchApi.js
+++ b/common-util/useFetchApi.js
@@ -38,9 +38,11 @@ export const useFetchVideos = (limit = 1000) => {
const imageFilename = thumbnailUrl
? `${process.env.NEXT_PUBLIC_API_URL}${thumbnailUrl}`
: '';
-
+
const videoUploadedUrl = get(videoUploaded, 'data[0].attributes.url');
- const video_url = videoUploadedUrl ? `${process.env.NEXT_PUBLIC_API_URL}${videoUploadedUrl}` : '';
+ const video_url = videoUploadedUrl
+ ? `${process.env.NEXT_PUBLIC_API_URL}${videoUploadedUrl}`
+ : '';
return {
id,
diff --git a/components/Content/Article.jsx b/components/Content/Article.jsx
index a031c42..488429d 100644
--- a/components/Content/Article.jsx
+++ b/components/Content/Article.jsx
@@ -21,15 +21,19 @@ const Article = ({ article, href, showReadTime, showDate }) => {
return data?.attributes?.formats?.large;
}, [article]);
- const { title, datePublished, readTime } = article.attributes;
+ const {
+ title,
+ datePublished: unFormattedDatePublished,
+ readTime,
+ } = article.attributes;
const { url, width, height } = image || {};
- const formattedDate = formatDate(datePublished);
+ const datePublished = formatDate(unFormattedDatePublished);
const moreInfo = useMemo(() => {
const moreInfoArray = [];
- if (showDate && formattedDate) {
- moreInfoArray.push(formattedDate);
+ if (showDate && datePublished) {
+ moreInfoArray.push(datePublished);
}
if (showReadTime && readTime) {
@@ -37,7 +41,7 @@ const Article = ({ article, href, showReadTime, showDate }) => {
}
return moreInfoArray.join(' • ');
- }, [showDate, formattedDate, showReadTime, readTime]);
+ }, [showDate, datePublished, showReadTime, readTime]);
return (
diff --git a/components/HomepageSection/Media.jsx b/components/HomepageSection/Media.jsx
index 68eea76..6a32a3a 100644
--- a/components/HomepageSection/Media.jsx
+++ b/components/HomepageSection/Media.jsx
@@ -3,10 +3,10 @@ import Articles from 'components/Content/Articles';
import { Videos } from 'components/Content/Videos';
import SectionWrapper from 'components/Layout/SectionWrapper';
-const limit = 3;
+const LIMIT = 3;
const Media = () => {
- const { videos, isLoading } = useFetchVideos(limit);
+ const { videos, isLoading } = useFetchVideos(LIMIT);
return (
{
customClasses="px-4 md:px-8 py-12 lg:p-24 border-b"
>
);