diff --git a/client/src/document.js b/client/src/document.js
index 1f936516c5a1..fb9a8c8309d1 100644
--- a/client/src/document.js
+++ b/client/src/document.js
@@ -4,7 +4,7 @@ import { Link } from "@reach/router";
import { NoMatch } from "./routing";
import { InteractiveExample } from "./ingredients/interactive-example";
import { Attributes } from "./ingredients/attributes";
-import { Examples } from "./ingredients/examples";
+import { Example, Examples } from "./ingredients/examples";
import { BrowserCompatibilityTable } from "./ingredients/browser-compatibility-table";
export class Document extends React.Component {
@@ -149,7 +149,7 @@ function RenderDocumentBody({ doc }) {
if (section.type === "prose") {
// Only exceptional few should use the component,
// as opposed to .
- if (PROSE_NO_HEADING.includes(section.value.id)) {
+ if (!section.value.id || PROSE_NO_HEADING.includes(section.value.id)) {
return ;
} else {
return (
@@ -180,6 +180,8 @@ function RenderDocumentBody({ doc }) {
);
} else if (section.type === "examples") {
return ;
+ } else if (section.type === "example") {
+ return ;
} else if (section.type === "info_box") {
// XXX Unfinished!
// https://github.com/mdn/stumptown-content/issues/106
diff --git a/client/src/ingredients/examples.js b/client/src/ingredients/examples.js
index ee51976e5dd5..c36d7024dc8f 100644
--- a/client/src/ingredients/examples.js
+++ b/client/src/ingredients/examples.js
@@ -54,7 +54,7 @@ function RenderLiveSample({ example }) {
className="live-sample-frame"
srcDoc={srcdoc}
title={example.description.title || "Live sample"}
- width={example.description.width}
+ width={example.description.width || "100%"}
height={example.description.height}
frameBorder={0}
/>
@@ -62,7 +62,7 @@ function RenderLiveSample({ example }) {
);
}
-function RenderExample({ example }) {
+export function Example({ example }) {
return (
<>
{example.description.title &&
{example.description.title}
}
@@ -77,7 +77,7 @@ function RenderExample({ example }) {
{/* At the moment the author implicitly signals that an example is live
by including width and height values for the iframe */}
- {example.description.width && }
+ {example.description.height && }
>
);
}
@@ -87,7 +87,7 @@ export function Examples({ examples }) {
<>
Examples
{examples.map((example, i) => (
-
+
))}
>
);