diff --git a/apps/docs/components/button.mdx b/apps/docs/components/button.mdx index c32e9f577e..6ff7ebc45d 100644 --- a/apps/docs/components/button.mdx +++ b/apps/docs/components/button.mdx @@ -6,7 +6,8 @@ description: "A link that is styled to look like a button." icon: "b" --- -import Support from '/snippets/support.mdx' +import Support from "/snippets/support.mdx"; +import { ComponentPreview } from "/snippets/component-preview.mdx"; Semantics: Quite often in the email world we talk about buttons, when actually @@ -49,20 +50,45 @@ pnpm add @react-email/button -E Add the component to your email template. Include styles where needed. -```jsx + +```tsx import { Button } from "@react-email/components"; const Email = () => { return ( ); }; ``` + ## Props @@ -74,4 +100,4 @@ const Email = () => { Specify the target attribute for the button link - + diff --git a/apps/docs/components/code-block.mdx b/apps/docs/components/code-block.mdx index bd560f0da6..61c43987fd 100644 --- a/apps/docs/components/code-block.mdx +++ b/apps/docs/components/code-block.mdx @@ -6,6 +6,7 @@ icon: 'file-lines' --- import Support from '/snippets/support.mdx' +import { ComponentPreview } from '/snippets/component-preview.mdx' ## Install @@ -43,8 +44,31 @@ pnpm add @react-email/code-block -E Add the component into your email component as follows. + ```jsx -import { CodeBlock, dracula } from '@react-email/code-block'; +import { CodeBlock, dracula } from "@react-email/components"; const Email = () => { const code = `export default async (req, res) => { @@ -66,6 +90,7 @@ const Email = () => { />); }; ``` + This should render a code-block with the desired theme. diff --git a/apps/docs/components/code-inline.mdx b/apps/docs/components/code-inline.mdx index cc06283ad4..dfbd878676 100644 --- a/apps/docs/components/code-inline.mdx +++ b/apps/docs/components/code-inline.mdx @@ -6,6 +6,7 @@ icon: 'code' --- import Support from '/snippets/support.mdx' +import {ComponentPreview} from '/snippets/component-preview.mdx' ## Install @@ -43,12 +44,38 @@ pnpm add @react-email/code-inline -E Add the component to your email template. Include styles where needed. + ```jsx -import { CodeInline } from "@react-email/code-inline"; +import { CodeInline } from "@react-email/components"; const Email = () => { - return @react-email/code-inline; + return + @react-email/code-inline + ; } ``` + diff --git a/apps/docs/components/column.mdx b/apps/docs/components/column.mdx index 21c665082a..1c6e702a5f 100644 --- a/apps/docs/components/column.mdx +++ b/apps/docs/components/column.mdx @@ -7,6 +7,7 @@ icon: "columns-3" --- import Support from '/snippets/support.mdx' +import {ComponentPreview} from '/snippets/component-preview.mdx' ## Install @@ -44,18 +45,80 @@ pnpm add @react-email/column -E Add the component to your email template. Include styles where needed. + ```jsx import { Column, Row } from "@react-email/components"; const Email = () => { return ( - A - B - C + + A + + + B + + + C + ); }; ``` + diff --git a/apps/docs/components/heading.mdx b/apps/docs/components/heading.mdx index 913360ce05..590e01e49a 100644 --- a/apps/docs/components/heading.mdx +++ b/apps/docs/components/heading.mdx @@ -7,6 +7,7 @@ icon: "h1" --- import Support from '/snippets/support.mdx' +import { ComponentPreview } from '/snippets/component-preview.mdx' ## Install @@ -44,13 +45,25 @@ pnpm add @react-email/heading -E Add the component to your email template. Include styles where needed. + ```jsx import { Heading } from "@react-email/components"; const Email = () => { - return Lorem ipsum; + return + Lorem ipsum + ; }; ``` + ## Props diff --git a/apps/docs/components/hr.mdx b/apps/docs/components/hr.mdx index e2f9ecd676..6021eb23ac 100644 --- a/apps/docs/components/hr.mdx +++ b/apps/docs/components/hr.mdx @@ -7,6 +7,7 @@ icon: "horizontal-rule" --- import Support from '/snippets/support.mdx' +import { ComponentPreview } from '/snippets/component-preview.mdx' ## Install @@ -44,12 +45,28 @@ pnpm add @react-email/hr -E Add the component to your email template. Include styles where needed. + ```jsx -import { Hr } from "@react-email/components"; +import { Hr, Heading, Text, Section } from "@react-email/components"; const Email = () => { - return
; + return
+ Hello +
+ world +
; }; ``` +
diff --git a/apps/docs/components/link.mdx b/apps/docs/components/link.mdx index a7a59012b0..973f5cda8c 100644 --- a/apps/docs/components/link.mdx +++ b/apps/docs/components/link.mdx @@ -6,7 +6,8 @@ description: "A hyperlink to web pages, email addresses, or anything else a URL icon: "link" --- -import Support from '/snippets/support.mdx' +import Support from "/snippets/support.mdx"; +import { ComponentPreview } from "/snippets/component-preview.mdx"; ## Install @@ -44,6 +45,14 @@ pnpm add @react-email/link -E Add the component to your email template. Include styles where needed. + + ```jsx import { Link } from "@react-email/components"; @@ -52,6 +61,8 @@ const Email = () => { }; ``` + + ## Props @@ -62,4 +73,4 @@ const Email = () => { Specify the target attribute for the button link - + diff --git a/apps/docs/components/markdown.mdx b/apps/docs/components/markdown.mdx index 3c9730b0b8..dd500d65f3 100644 --- a/apps/docs/components/markdown.mdx +++ b/apps/docs/components/markdown.mdx @@ -7,6 +7,7 @@ icon: "file-code" --- import Support from '/snippets/support.mdx' +import { ComponentPreview } from '/snippets/component-preview.mdx' ## Install @@ -44,6 +45,35 @@ pnpm add @react-email/markdown -E Add the component to your email template. Include styles where needed. + ```jsx import { Markdown, Html } from "@react-email/components"; @@ -52,23 +82,28 @@ const Email = () => { {`# Hello, World!`} {/* OR */} - + ); }; ``` + ## Props diff --git a/apps/docs/components/row.mdx b/apps/docs/components/row.mdx index 28743b34b7..d89eb818a6 100644 --- a/apps/docs/components/row.mdx +++ b/apps/docs/components/row.mdx @@ -6,7 +6,8 @@ description: "Display a row that separates content areas horizontally in your em icon: "table-rows" --- -import Support from '/snippets/support.mdx' +import Support from "/snippets/support.mdx"; +import { ComponentPreview } from "/snippets/component-preview.mdx"; ## Install @@ -44,24 +45,94 @@ pnpm add @react-email/row -E Add the component to your email template. Include styles where needed. + + ```jsx import { Row, Column, Section } from "@react-email/components"; const Email = () => { return (
- - A + + + A + - - B + + + B + - - C + + + C +
); }; ``` - +
+ + diff --git a/apps/docs/components/section.mdx b/apps/docs/components/section.mdx index 3d1bf8caed..0541c3906f 100644 --- a/apps/docs/components/section.mdx +++ b/apps/docs/components/section.mdx @@ -7,6 +7,7 @@ icon: "rectangles-mixed" --- import Support from '/snippets/support.mdx' +import { ComponentPreview } from '/snippets/component-preview.mdx' ## Install @@ -44,29 +45,58 @@ pnpm add @react-email/section -E Add the component to your email template. Include styles where needed. + ```jsx import { Section, Column, Row, Text } from "@react-email/components"; const Email = () => { return ( - {/* A simple `section` */} -
- Hello World -
- - {/* Formatted with `rows` and `columns` */} -
- - Column 1, Row 1 - Column 2, Row 1 - - - Column 1, Row 2 - Column 2, Row 2 - -
+ <> + {/* A simple `section` */} +
+ Hello World +
+ + {/* Formatted with `rows` and `columns` */} +
+ + Column 1, Row 1 + Column 2, Row 1 + + + Column 1, Row 2 + Column 2, Row 2 + +
+ ); }; ``` +
diff --git a/apps/docs/components/text.mdx b/apps/docs/components/text.mdx index 73793c6756..3982b8854e 100644 --- a/apps/docs/components/text.mdx +++ b/apps/docs/components/text.mdx @@ -7,6 +7,7 @@ icon: "text-size" --- import Support from '/snippets/support.mdx' +import { ComponentPreview } from '/snippets/component-preview.mdx' ## Install @@ -44,12 +45,20 @@ pnpm add @react-email/text -E Add the component to your email template. Include styles where needed. + ```jsx import { Text } from "@react-email/components"; const Email = () => { - return Lorem ipsum; + return Lorem ipsum; }; ``` + diff --git a/apps/docs/getting-started/migrating-to-react-email.mdx b/apps/docs/getting-started/migrating-to-react-email.mdx index a3cc473931..0443abc565 100644 --- a/apps/docs/getting-started/migrating-to-react-email.mdx +++ b/apps/docs/getting-started/migrating-to-react-email.mdx @@ -6,7 +6,7 @@ description: 'Migrate from another email rendering framework to React Email' icon: 'paper-plane' --- -import NextSteps from '../snippets/next-steps.mdx'; +import NextSteps from '/snippets/next-steps.mdx'; ## From MJML diff --git a/apps/docs/snippets/component-preview.mdx b/apps/docs/snippets/component-preview.mdx new file mode 100644 index 0000000000..420cd7babc --- /dev/null +++ b/apps/docs/snippets/component-preview.mdx @@ -0,0 +1,72 @@ +export const ComponentPreview = ({ children, code }) => { + const preElement = children.props.children; + + return ( + +
+ +
+
+ +
+ {preElement} +
+
+ ); +};