update banner-img

This commit is contained in:
somrat sorkar
2023-07-24 10:02:33 +06:00
parent 0d3562c1bf
commit abed7aa2a8
14 changed files with 52 additions and 60 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import { formatInTimeZone } from "date-fns-tz";
const dateFormat = (
date: Date | string,
format: string = "dd MMM, yyyy"
format: string = "dd MMM, yyyy",
): string => {
return formatInTimeZone(date, "America/New_York", format);
};
+2 -2
View File
@@ -15,12 +15,12 @@ const similerItems = (currentItem: any, allItems: any, slug: string) => {
// filter by categories
const filterByCategories = allItems.filter((item: any) =>
categories.find((category) => item.data.categories.includes(category))
categories.find((category) => item.data.categories.includes(category)),
);
// filter by tags
const filterByTags = allItems.filter((item: any) =>
tags.find((tag) => item.data.tags.includes(tag))
tags.find((tag) => item.data.tags.includes(tag)),
);
// merged after filter
+4 -4
View File
@@ -3,7 +3,7 @@ export const sortByDate = (array: any[]) => {
const sortedArray = array.sort(
(a: any, b: any) =>
new Date(b.data.date && b.data.date).valueOf() -
new Date(a.data.date && a.data.date).valueOf()
new Date(a.data.date && a.data.date).valueOf(),
);
return sortedArray;
};
@@ -11,14 +11,14 @@ export const sortByDate = (array: any[]) => {
// sort product by weight
export const sortByWeight = (array: any[]) => {
const withWeight = array.filter(
(item: { data: { weight: any } }) => item.data.weight
(item: { data: { weight: any } }) => item.data.weight,
);
const withoutWeight = array.filter(
(item: { data: { weight: any } }) => !item.data.weight
(item: { data: { weight: any } }) => !item.data.weight,
);
const sortedWeightedArray = withWeight.sort(
(a: { data: { weight: number } }, b: { data: { weight: number } }) =>
a.data.weight - b.data.weight
a.data.weight - b.data.weight,
);
const sortedArray = [...new Set([...sortedWeightedArray, ...withoutWeight])];
return sortedArray;
+1 -1
View File
@@ -2,7 +2,7 @@ import { slugify } from "@/lib/utils/textConverter";
const taxonomyFilter = (posts: any[], name: string, key: string) =>
posts.filter((post) =>
post.data[name].map((name: string) => slugify(name)).includes(key)
post.data[name].map((name: string) => slugify(name)).includes(key),
);
export default taxonomyFilter;