feat(SW-213): Created Text Cols component and added to Blocks in Contentstack
This commit is contained in:
26
components/Content/Blocks/TextCols/index.tsx
Normal file
26
components/Content/Blocks/TextCols/index.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
import JsonToHtml from "@/components/JsonToHtml"
|
||||
import Subtitle from "@/components/TempDesignSystem/Text/Subtitle"
|
||||
|
||||
import styles from "./textcols.module.css"
|
||||
|
||||
import { TextColsProps } from "@/types/components/content/blocks"
|
||||
|
||||
export default function TextCols({ text_cols }: TextColsProps) {
|
||||
return (
|
||||
<div className={styles.columns}>
|
||||
{text_cols.columns.map((col) => {
|
||||
return (
|
||||
<div key={col.title} className={styles.column}>
|
||||
<Subtitle>{col.title}</Subtitle>
|
||||
<div className={styles.text}>
|
||||
<JsonToHtml
|
||||
nodes={col.text.json.children}
|
||||
embeds={col.text.embedded_itemsConnection.edges}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
36
components/Content/Blocks/TextCols/textcols.module.css
Normal file
36
components/Content/Blocks/TextCols/textcols.module.css
Normal file
@@ -0,0 +1,36 @@
|
||||
.columns {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--Spacing-x3);
|
||||
padding: var(--Spacing-x3) var(--Spacing-x4);
|
||||
background-color: var(--UI-Opacity-White-100);
|
||||
}
|
||||
|
||||
.column {
|
||||
padding-bottom: var(--Spacing-x2);
|
||||
border-bottom: 1px solid var(--Base-Border-Subtle);
|
||||
gap: var(--Spacing-x1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.text p {
|
||||
color: var(--UI-Text-High-contrast);
|
||||
line-height: var(--Spacing-x3);
|
||||
}
|
||||
|
||||
.text section {
|
||||
gap: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.columns {
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.column {
|
||||
flex: 0 0 calc(50% - var(--Spacing-x3));
|
||||
max-width: calc(50% - var(--Spacing-x3));
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import JsonToHtml from "@/components/JsonToHtml"
|
||||
import Shortcuts from "@/components/MyPages/Blocks/Shortcuts"
|
||||
|
||||
import CardsGrid from "./CardsGrid"
|
||||
import TextCols from "./TextCols"
|
||||
|
||||
import type { BlocksProps } from "@/types/components/content/blocks"
|
||||
import { ContentBlocksTypenameEnum } from "@/types/components/content/enums"
|
||||
@@ -38,6 +39,8 @@ export function Blocks({ blocks }: BlocksProps) {
|
||||
firstItem={firstItem}
|
||||
/>
|
||||
)
|
||||
case ContentBlocksTypenameEnum.ContentPageBlocksTextCols:
|
||||
return <TextCols text_cols={block.text_cols} />
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user