diff --git a/src/components/Blog/BlogArticleCard/ActionButtons/cmp.tsx b/src/components/Blog/BlogArticleCard/ActionButtons/cmp.tsx
new file mode 100644
index 0000000..94f58c4
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/ActionButtons/cmp.tsx
@@ -0,0 +1,67 @@
+import LoadingBlinkBox from "@/components/LoadingBlinkBox";
+import { BlogCategoryProps } from "@/types/blog/BlogCategoryProps";
+import { Button, Icon } from "@aleph-front/core";
+
+export const ActionButtons = ({
+ blogArticleUrl,
+ category,
+ loading,
+ size,
+}: {
+ blogArticleUrl?: string;
+ category?: BlogCategoryProps;
+ size: string;
+ loading: boolean;
+}) => {
+ if (size === "highlighted")
+ return (
+
+
+
+
+
+
+ );
+ else
+ return (
+
+
+
+ );
+};
+
+export default ActionButtons;
diff --git a/src/components/Blog/BlogArticleCard/ActionButtons/index.tsx b/src/components/Blog/BlogArticleCard/ActionButtons/index.tsx
new file mode 100644
index 0000000..a05ebc5
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/ActionButtons/index.tsx
@@ -0,0 +1 @@
+export { default } from "./cmp";
diff --git a/src/components/Blog/BlogArticleCard/Category/cmp.tsx b/src/components/Blog/BlogArticleCard/Category/cmp.tsx
new file mode 100644
index 0000000..311bc6d
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Category/cmp.tsx
@@ -0,0 +1,17 @@
+import LoadingBlinkBox from "@/components/LoadingBlinkBox";
+
+export const Category = ({
+ children,
+ loading,
+}: {
+ children: React.ReactNode;
+ loading: boolean;
+}) => {
+ return (
+
+ {children}
+
+ );
+};
+
+export default Category;
diff --git a/src/components/Blog/BlogArticleCard/Category/index.tsx b/src/components/Blog/BlogArticleCard/Category/index.tsx
new file mode 100644
index 0000000..a05ebc5
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Category/index.tsx
@@ -0,0 +1 @@
+export { default } from "./cmp";
diff --git a/src/components/Blog/BlogArticleCard/Description/cmp.tsx b/src/components/Blog/BlogArticleCard/Description/cmp.tsx
new file mode 100644
index 0000000..7a5b397
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Description/cmp.tsx
@@ -0,0 +1,20 @@
+import LoadingBlinkBox from "@/components/LoadingBlinkBox";
+import { StyledDescription } from "./styles";
+
+export const Description = ({
+ children,
+ size,
+ loading,
+}: {
+ children: React.ReactNode;
+ size: string;
+ loading: boolean;
+}) => {
+ return (
+
+ {children}
+
+ );
+};
+
+export default Description;
diff --git a/src/components/Blog/BlogArticleCard/Description/index.tsx b/src/components/Blog/BlogArticleCard/Description/index.tsx
new file mode 100644
index 0000000..a05ebc5
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Description/index.tsx
@@ -0,0 +1 @@
+export { default } from "./cmp";
diff --git a/src/components/Blog/BlogArticleCard/Description/styles.tsx b/src/components/Blog/BlogArticleCard/Description/styles.tsx
new file mode 100644
index 0000000..b82499e
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Description/styles.tsx
@@ -0,0 +1,24 @@
+import styled, { css } from "styled-components";
+import tw from "twin.macro";
+import { getResponsiveCss } from "@aleph-front/core";
+
+export const StyledDescription = styled.p<{ size: string }>`
+ ${tw`line-clamp-3 whitespace-pre-wrap`}
+ ${({ size }) => {
+ if (size === "lg")
+ return css`
+ margin-bottom: 1.5rem;
+ ${getResponsiveCss("lg", "max-width: 77%;")}
+ `;
+ else if (size === "xl" || size === "full")
+ return css`
+ margin-bottom: 3rem;
+ ${getResponsiveCss("lg", "max-width: 77%;")}
+ `;
+ else if (size === "highlighted") return;
+ else
+ return css`
+ margin-bottom: 1.5rem;
+ `;
+ }}
+`;
diff --git a/src/components/Blog/BlogArticleCard/FeatureImage/cmp.tsx b/src/components/Blog/BlogArticleCard/FeatureImage/cmp.tsx
new file mode 100644
index 0000000..4cdf83c
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/FeatureImage/cmp.tsx
@@ -0,0 +1,20 @@
+import LoadingBlinkBox from "@/components/LoadingBlinkBox";
+import Image from "next/image";
+
+export const FeatureImage = ({
+ src,
+ loading,
+}: {
+ src: string;
+ loading: boolean;
+}) => {
+ return (
+
+
+
+
+
+ );
+};
+
+export default FeatureImage;
diff --git a/src/components/Blog/BlogArticleCard/FeatureImage/index.tsx b/src/components/Blog/BlogArticleCard/FeatureImage/index.tsx
new file mode 100644
index 0000000..a05ebc5
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/FeatureImage/index.tsx
@@ -0,0 +1 @@
+export { default } from "./cmp";
diff --git a/src/components/Blog/BlogArticleCard/Headline/cmp.tsx b/src/components/Blog/BlogArticleCard/Headline/cmp.tsx
new file mode 100644
index 0000000..9e99c49
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Headline/cmp.tsx
@@ -0,0 +1,20 @@
+import LoadingBlinkBox from "@/components/LoadingBlinkBox";
+import { StyledHeadline } from "./styles";
+
+export const Headline = ({
+ children,
+ size,
+ loading,
+}: {
+ children: React.ReactNode;
+ size: string;
+ loading: boolean;
+}) => {
+ return (
+
+ {children}
+
+ );
+};
+
+export default Headline;
diff --git a/src/components/Blog/BlogArticleCard/Headline/index.tsx b/src/components/Blog/BlogArticleCard/Headline/index.tsx
new file mode 100644
index 0000000..a05ebc5
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Headline/index.tsx
@@ -0,0 +1 @@
+export { default } from "./cmp";
diff --git a/src/components/Blog/BlogArticleCard/Headline/styles.tsx b/src/components/Blog/BlogArticleCard/Headline/styles.tsx
new file mode 100644
index 0000000..ea40a93
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Headline/styles.tsx
@@ -0,0 +1,14 @@
+import styled from "styled-components";
+import tw from "twin.macro";
+
+export const StyledHeadline = styled(
+ ({ children, size: string, className: styledClassName }) => {
+ return {children}
;
+ }
+)`
+ ${tw`line-clamp-2 whitespace-pre-wrap`}
+ ${({ size }) => {
+ console.log(size);
+ if (size === "full") return tw`mb-4`;
+ }}
+`;
diff --git a/src/components/Blog/BlogArticleCard/ThumbnailImage/cmp.tsx b/src/components/Blog/BlogArticleCard/ThumbnailImage/cmp.tsx
new file mode 100644
index 0000000..01f65aa
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/ThumbnailImage/cmp.tsx
@@ -0,0 +1,20 @@
+import LoadingBlinkBox from "@/components/LoadingBlinkBox";
+import Image from "next/image";
+
+export const ThumbnailImage = ({
+ src,
+ loading,
+}: {
+ src: string;
+ loading: boolean;
+}) => {
+ return (
+
+
+
+
+
+ );
+};
+
+export default ThumbnailImage;
diff --git a/src/components/Blog/BlogArticleCard/ThumbnailImage/index.tsx b/src/components/Blog/BlogArticleCard/ThumbnailImage/index.tsx
new file mode 100644
index 0000000..a05ebc5
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/ThumbnailImage/index.tsx
@@ -0,0 +1 @@
+export { default } from "./cmp";
diff --git a/src/components/Blog/BlogArticleCard/Title/cmp.tsx b/src/components/Blog/BlogArticleCard/Title/cmp.tsx
new file mode 100644
index 0000000..94f2f89
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Title/cmp.tsx
@@ -0,0 +1,30 @@
+import LoadingBlinkBox from "@/components/LoadingBlinkBox";
+import { StyledTitle } from "./styles";
+
+export const Title = ({
+ children,
+ size,
+ loading,
+}: {
+ children: React.ReactNode;
+ size: string;
+ loading: boolean;
+}) => {
+ const loadingHeight = () => {
+ if (size === "highlighted" || size === "full") return "6rem";
+ if (size === "xl") return "4rem";
+ else return "2rem";
+ };
+
+ return (
+
+ {children}
+
+ );
+};
+
+export default Title;
diff --git a/src/components/Blog/BlogArticleCard/Title/index.tsx b/src/components/Blog/BlogArticleCard/Title/index.tsx
new file mode 100644
index 0000000..a05ebc5
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Title/index.tsx
@@ -0,0 +1 @@
+export { default } from "./cmp";
diff --git a/src/components/Blog/BlogArticleCard/Title/styles.tsx b/src/components/Blog/BlogArticleCard/Title/styles.tsx
new file mode 100644
index 0000000..2f750a0
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/Title/styles.tsx
@@ -0,0 +1,43 @@
+import { TextGradient } from "@aleph-front/core";
+import styled from "styled-components";
+import tw from "twin.macro";
+
+export const StyledTitle = styled(
+ ({ children, size, className: styledClassName }) => {
+ switch (size) {
+ case "xl":
+ return (
+
+ {children}
+
+ );
+ case "full":
+ return (
+
+ {children}
+
+ );
+ case "highlighted":
+ return (
+
+ {children}
+
+ );
+ default:
+ return (
+ {children}
+ );
+ }
+ }
+)`
+ ${tw`line-clamp-3 whitespace-pre-wrap w-fit`}
+ ${({ size }) => {
+ if (size === "xl" || size == "highlighted") return tw`mb-0`;
+ }}
+`;
diff --git a/src/components/Blog/BlogArticleCard/cmp.tsx b/src/components/Blog/BlogArticleCard/cmp.tsx
index 441aada..6f04f17 100644
--- a/src/components/Blog/BlogArticleCard/cmp.tsx
+++ b/src/components/Blog/BlogArticleCard/cmp.tsx
@@ -1,10 +1,15 @@
import React from "react";
+import { Col, Row } from "@aleph-front/core";
import { BlogArticleCardProps } from "./types";
-import Image from "next/image";
-import { Button, Col, Icon, Row, TextGradient } from "@aleph-front/core";
-import LoadingBlinkBox from "@/components/LoadingBlinkBox";
+import Title from "./Title";
+import Description from "./Description";
+import Headline from "./Headline";
+import ThumbnailImage from "./ThumbnailImage";
+import FeatureImage from "./FeatureImage";
+import Category from "./Category";
+import ActionButtons from "./ActionButtons";
+import { CardWrapper, HeaderWrapper, ThumbnailImageWrapper } from "./styles";
-// TODO: Refactor to use styled components
// TODO: Move to front-core (probably)
export const BlogArticleCard = ({
title,
@@ -18,394 +23,107 @@ export const BlogArticleCard = ({
loading = false,
}: BlogArticleCardProps) => {
switch (size) {
- case "md":
- return (
-
-
-
-
- {category}
-
-
-
- {title}
-
-
-
-
-
- {description}
-
-
-
-
-
-
- );
- case "lg":
- return (
-
-
-
-
-
- {category}
-
-
-
- {title}
-
-
-
-
-
- {description}
-
-
-
-
-
-
- );
- case "xl":
- return (
-
-
-
-
- {category}
-
-
-
- {title}
-
-
- {headline}
-
-
-
-
-
- {description}
-
-
-
-
-
-
- );
case "full":
- const imageCmpFull = (
-
-
-
-
-
- );
-
return (
-
+
-
- {category}
-
-
-
- {title}
-
-
+
{category?.displayName}
+
+ {title}
+
-
-
- {headline}
-
-
-
{imageCmpFull}
-
-
- {description}
-
-
+
+ {headline}
+
+
+
+
+
+ {description}
+
-
-
-
+ />
- {imageCmpFull}
+
+
+
-
+
);
case "highlighted":
- const imageCmpHighlighted = (
-
-
-
-
-
- );
-
return (
-
+
-
- {category}
-
-
-
- {title}
-
-
-
-
- {headline}
-
-
+
{category?.displayName}
+
+ {title}
+
+
+ {headline}
+
+
+
+
- {imageCmpHighlighted}
-
-
-
- {description}
-
-
-
-
-
-
-
-
-
+
+ {description}
+
+
- {imageCmpHighlighted}
+
+
+
-
+
+ );
+ default:
+ return (
+
+
+
+
+
+ {category?.displayName}
+
+ {title}
+
+ {size === "xl" && (
+
+ {headline}
+
+ )}
+
+
+ {description}
+
+
+
);
}
};
diff --git a/src/components/Blog/BlogArticleCard/styles.tsx b/src/components/Blog/BlogArticleCard/styles.tsx
new file mode 100644
index 0000000..3b04ba3
--- /dev/null
+++ b/src/components/Blog/BlogArticleCard/styles.tsx
@@ -0,0 +1,33 @@
+import styled from "styled-components";
+import tw from "twin.macro";
+
+export const CardWrapper = styled.div<{ size: string }>`
+ ${tw`w-full h-fit`}
+ ${({ size }) => {
+ if (size === "md" || size === "lg") return tw`p-3`;
+ else if (size === "xl") return tw`p-6`;
+ else if (size === "full") return tw`p-12`;
+ else if (size === "highlighted") return tw`py-10`;
+ }}
+`;
+
+export const ThumbnailImageWrapper = styled.div<{ size: string }>`
+ ${tw`relative w-full`}
+ ${({ size }) => {
+ switch (size) {
+ case "md":
+ return tw`h-20 mb-2`;
+ case "lg":
+ return tw`h-48 mb-2`;
+ case "xl":
+ return tw`h-48 mb-6`;
+ }
+ }}
+`;
+
+export const HeaderWrapper = styled.div<{ size: string }>`
+ ${({ size }) => {
+ if (size === "md" || size === "lg") return tw`mb-2`;
+ else if (size === "xl") return tw`mb-4`;
+ }}
+`;
diff --git a/src/components/Blog/BlogArticleCard/types.ts b/src/components/Blog/BlogArticleCard/types.ts
index 6a6e762..7f66f1c 100644
--- a/src/components/Blog/BlogArticleCard/types.ts
+++ b/src/components/Blog/BlogArticleCard/types.ts
@@ -1,11 +1,13 @@
+import { BlogCategoryProps } from "@/types/blog/BlogCategoryProps";
+
export type BlogArticleCardProps = {
- title: string;
- headline: string;
- description: string;
+ title?: string;
+ headline?: string;
+ description?: string;
thumbnailImage?: string;
featureImage?: string;
- category: string;
- blogArticleUrl: string;
+ category?: BlogCategoryProps;
+ blogArticleUrl?: string;
size?: "md" | "lg" | "xl" | "full" | "highlighted";
loading?: boolean;
};
diff --git a/src/components/Blog/BlogArticlesGrid/cmp.tsx b/src/components/Blog/BlogArticlesGrid/cmp.tsx
index 58d43d8..4988f81 100644
--- a/src/components/Blog/BlogArticlesGrid/cmp.tsx
+++ b/src/components/Blog/BlogArticlesGrid/cmp.tsx
@@ -9,6 +9,7 @@ import { GetContentOptions } from "@builder.io/sdk";
import { useSearchParams } from "next/navigation";
import { DEFAULT_BUILDER_REQUEST_OPTIONS } from "@/constants/blog";
import { useTheme } from "styled-components";
+import { BlogCategoryProps } from "@/types/blog/BlogCategoryProps";
function buildFilters(searchParams: any, pageCategorization: any): any {
const queryParams = new URLSearchParams(searchParams);
@@ -142,13 +143,6 @@ export const AllBlogArticles = ({
{Array.from({ length: articlesPerPage }).map((_, index) => (
@@ -173,7 +167,7 @@ export const AllBlogArticles = ({
featureImage={blogArticle.featureImage}
blogArticleUrl={blogArticle.url}
size={articleSize}
- category={blogArticle.category.value.data.displayName}
+ category={blogArticle.category.value.data as BlogCategoryProps}
/>
);
})}