diff --git a/docs/Playground.module.css b/docs/Playground.module.css
new file mode 100644
index 0000000..d2590c8
--- /dev/null
+++ b/docs/Playground.module.css
@@ -0,0 +1,27 @@
+.playground {
+ display: flex;
+ flex-direction: column;
+ border: 1px solid grey;
+ border-radius: 10px;
+ justify-content: center;
+ padding: 0.25rem;
+}
+
+.subheading {
+ border-bottom: 1px solid grey;
+ padding: 0.25rem;
+ margin: auto 10px;
+ display: flex;
+ justify-content: space-between;
+}
+
+.tabButton {
+ padding: 0.375rem 0.75rem;
+ border-radius: 0.375rem;
+ background-color: transparent;
+}
+
+.selectedTabButton {
+ background-color: rgba(218, 200, 200, 0.3);
+ color: white;
+}
diff --git a/docs/Playground.tsx b/docs/Playground.tsx
index ad492d3..86ab252 100644
--- a/docs/Playground.tsx
+++ b/docs/Playground.tsx
@@ -1,22 +1,31 @@
'use server';
+import { clsx } from 'clsx';
+import { CodeXml, Smartphone, Tablet, TvMinimal } from 'lucide-react';
import { useMemo, useState } from 'react';
import { type Component } from '../emails/jsx.js';
import { render } from '../emails/render.js';
import { jsx } from '../emails/runtime.js';
+import styles from './Playground.module.css';
+import { DisplayRawFile } from './RawFunction.js';
export type PlaygroundProps = {
component: Component<{}>;
+ label: string;
+ rawFunction: string;
};
export function Playground(props: PlaygroundProps) {
- const { component } = props;
+ const { component, label, rawFunction } = props;
const [dimension, setDimension] = useState({
- height: '480',
- width: '320',
+ height: '100%',
+ width: '40%',
});
+ const [selectedTab, setSelectedTab] = useState<
+ 'phone' | 'tablet' | 'desktop' | 'code'
+ >('phone');
// This needs to be executed server-side due to
// `render` being a server-side function.
@@ -25,69 +34,90 @@ export function Playground(props: PlaygroundProps) {
}, [component]);
return (
-
-
-
-
-
+ srcDoc={template}
+ width={dimension.width}
+ height={dimension.height}
+ />
+ )}
);
}
diff --git a/docs/RawFunction.tsx b/docs/RawFunction.tsx
index 2a1907e..7b5c9ed 100644
--- a/docs/RawFunction.tsx
+++ b/docs/RawFunction.tsx
@@ -13,13 +13,14 @@ export const CodeBlock: React.FC<{ language: string; children: string }> = ({
);
-export function DisplayRawFile({
- rawFile,
- functionName,
-}: {
+export type DisplayRawFileProps = {
rawFile: string;
functionName: string;
-}) {
+ className?: string;
+};
+
+export function DisplayRawFile(props: DisplayRawFileProps) {
+ const { rawFile, functionName, className } = props;
const codeRef = useRef(null);
const code = extractFunction(rawFile, functionName);
@@ -31,9 +32,14 @@ export function DisplayRawFile({
return (
- {code}
+
+ {code}
+
);
-
- // return {code};
}
diff --git a/docs/pages/kits/button.mdx b/docs/pages/kits/button.mdx
index dd0fac5..3bdec7d 100644
--- a/docs/pages/kits/button.mdx
+++ b/docs/pages/kits/button.mdx
@@ -4,11 +4,9 @@ import rawButtonPlay1 from '!!raw-loader!../../../kits/Button.play.js';
import { ButtonPlay1 } from '../../../kits/Button.play.js';
import { Playground } from '../../Playground.js';
-import { DisplayRawFile } from '../../RawFunction.js';
-
-
-
diff --git a/kits/Button.play.tsx b/kits/Button.play.tsx
index a1b61ad..c64dfd4 100644
--- a/kits/Button.play.tsx
+++ b/kits/Button.play.tsx
@@ -9,6 +9,7 @@ export function ButtonPlay1() {
- Small Screen Button
-
-
- Medium Screen Button
-
-
- Large Screen Button
+ Get Started
diff --git a/kits/Button.tsx b/kits/Button.tsx
index 4a29961..94a7b1f 100644
--- a/kits/Button.tsx
+++ b/kits/Button.tsx
@@ -16,6 +16,7 @@ export type ButtonProps = {
fontStyle?: string;
fontWeight?: number;
height?: string;
+ width?: string;
innerPadding?: string;
letterSpacing?: string;
lineHeight?: string;
diff --git a/package.json b/package.json
index e917e75..d556f31 100644
--- a/package.json
+++ b/package.json
@@ -33,12 +33,15 @@
"license": "ISC",
"dependencies": {
"@types/mjml": "^4.7.4",
+ "clsx": "^2.1.1",
"decamelize-keys": "^2.0.1",
"highlight.js": "^11.11.1",
+ "lucide-react": "^0.474.0",
"mjml": "^4.15.3"
},
"devDependencies": {
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
+ "@types/css-modules": "^1.0.5",
"@types/mjml-core": "^4.15.1",
"@types/node": "^22.7.5",
"mjml-browser": "^4.15.3",