-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kipruto <[email protected]>
- Loading branch information
1 parent
f3172b7
commit 92fbd68
Showing
13 changed files
with
333 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
apps/roboshield/src/components/LongFormExternalEmbed/LongFormExternalEmbed.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { RichTypography } from "@commons-ui/core"; | ||
import { Box } from "@mui/material"; | ||
import React from "react"; | ||
import { ExternalEmbeddBlock } from "@/roboshield/components/Content/Content"; | ||
|
||
export default function LongFormExternalEmbed(props: ExternalEmbeddBlock) { | ||
const { externalEmbeddFields: { code = "", caption = "", url = "" } = {} } = | ||
props; | ||
|
||
return ( | ||
<Box | ||
sx={{ | ||
my: 5, | ||
}} | ||
> | ||
{code && <RichTypography>{code}</RichTypography>} | ||
{url && ( | ||
<iframe | ||
src={url} | ||
title={caption!} | ||
style={{ | ||
width: "100%", | ||
height: "500px", | ||
border: "none", | ||
}} | ||
/> | ||
)} | ||
</Box> | ||
); | ||
} |
3 changes: 3 additions & 0 deletions
3
apps/roboshield/src/components/LongFormExternalEmbed/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import LongFormExternalEmbed from "./LongFormExternalEmbed"; | ||
|
||
export default LongFormExternalEmbed; |
43 changes: 43 additions & 0 deletions
43
apps/roboshield/src/components/LongFormMedia/LongFormMedia.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Figure } from "@commons-ui/next"; | ||
import { Box } from "@mui/material"; | ||
import React from "react"; | ||
import { MediaBlock } from "@/roboshield/components/Content/Content"; | ||
import { Media } from "@/root/payload-types"; | ||
|
||
export default function LongFormMedia({ image }: MediaBlock) { | ||
const mediaImage = image as Media; | ||
return ( | ||
<Box | ||
sx={{ | ||
my: 5, | ||
}} | ||
> | ||
<Figure | ||
ImageProps={{ | ||
alt: mediaImage.alt, | ||
sx: { | ||
objectFit: "cover", | ||
position: "relative !important", | ||
}, | ||
src: mediaImage.url, | ||
}} | ||
sx={{ | ||
height: { | ||
xs: "200px", | ||
md: "500px", | ||
}, | ||
width: "100%", | ||
}} | ||
> | ||
<figcaption | ||
style={{ | ||
width: "100%", | ||
margin: "0 auto", | ||
}} | ||
> | ||
{mediaImage.alt} | ||
</figcaption> | ||
</Figure> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import LongFormMedia from "./LongFormMedia"; | ||
|
||
export default LongFormMedia; |
78 changes: 78 additions & 0 deletions
78
apps/roboshield/src/components/LongFormRichText/LongFormRichText.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import React from "react"; | ||
|
||
import RichText from "@/roboshield/components/RichText"; | ||
import { RichTextBlock } from "@/roboshield/components/Content/Content"; | ||
|
||
export default function LongFormRichText({ content }: RichTextBlock) { | ||
return ( | ||
<RichText | ||
elements={content} | ||
sx={(theme) => ({ | ||
color: "inherit", | ||
"& a, & a:visited, & a:hover": { | ||
color: "inherit", | ||
}, | ||
"& h1": { | ||
...theme.typography.h1, | ||
mb: 3.75, | ||
mt: 5, | ||
}, | ||
"& h2": { | ||
mb: 2.5, | ||
mt: 5, | ||
...theme.typography.h2, | ||
}, | ||
"& h3": { | ||
mb: 1.25, | ||
mt: 5, | ||
...theme.typography.h3, | ||
}, | ||
"& h4": { | ||
mb: 1.25, | ||
mt: 5, | ||
...theme.typography.h4, | ||
}, | ||
"& h5": { | ||
mb: 1.25, | ||
mt: 5, | ||
...theme.typography.h5Small, | ||
[theme.breakpoints.up("md")]: { | ||
...theme.typography.h5, | ||
}, | ||
}, | ||
"& h6": { | ||
mb: 1.25, | ||
mt: 5, | ||
...theme.typography.h6, | ||
}, | ||
"& p": { | ||
...theme.typography.body1, | ||
mb: 2, | ||
[theme.breakpoints.up("md")]: { | ||
...theme.typography.body3, | ||
}, | ||
}, | ||
"& a": { | ||
...theme.typography.body1, | ||
mb: 2, | ||
[theme.breakpoints.up("md")]: { | ||
...theme.typography.body3, | ||
}, | ||
}, | ||
"& ul": { | ||
mb: 2, | ||
}, | ||
"& li": { | ||
...theme.typography.body1, | ||
mt: 1, | ||
[theme.breakpoints.up("md")]: { | ||
...theme.typography.body3, | ||
}, | ||
}, | ||
"& :last-child": { | ||
mb: 0, | ||
}, | ||
})} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import LongFormRichText from "./LongFormRichText"; | ||
|
||
export default LongFormRichText; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Block } from "payload/types"; | ||
|
||
export const ExternalEmbedd: Block = { | ||
slug: "externalEmbedd", | ||
labels: { | ||
singular: "External Embedd", | ||
plural: "External Embedd", | ||
}, | ||
fields: [ | ||
{ | ||
name: "externalEmbeddFields", | ||
type: "group", | ||
fields: [ | ||
{ | ||
type: "row", | ||
fields: [ | ||
{ | ||
name: "embedType", | ||
type: "radio", | ||
defaultValue: "url", | ||
options: [ | ||
{ | ||
label: "URL", | ||
value: "url", | ||
}, | ||
{ | ||
label: "Code", | ||
value: "code", | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
name: "url", | ||
label: "URL", | ||
type: "text", | ||
required: true, | ||
admin: { | ||
condition: (_, siblingData) => siblingData?.embedType === "url", | ||
}, | ||
}, | ||
{ | ||
name: "caption", | ||
type: "text", | ||
localized: true, | ||
admin: { | ||
condition: (_, siblingData) => siblingData?.embedType === "url", | ||
}, | ||
}, | ||
{ | ||
name: "code", | ||
type: "code", | ||
required: true, | ||
admin: { | ||
condition: (_, siblingData) => siblingData?.embedType === "code", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}; |
Oops, something went wrong.