Skip to content

Commit 0eb97b9

Browse files
committed
add ternary example, link to mdxjs docs
1 parent 51eb765 commit 0eb97b9

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/content/docs/style-guide/components/render.mdx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,24 +102,40 @@ params:
102102

103103
Generic content.
104104

105+
{/* If `params={{ product: "Magic WAN" }}` is passed, this will result in `Content specific to Magic WAN only.` */}
105106
{ props.product === "Magic WAN" && <p>Content specific to Magic WAN only.</p> }
106107
```
107108

108109
Within JavaScript expressions, HTML or components must be used.
109110

110-
For example, when `params={{ path: "/foo/" }} is provided:
111+
For example, when `params={{ path: "/foo/" }}` is provided:
111112

112113
```mdx
113114
---
114115
params:
115116
- path
116117
---
117118

118-
{/* ❌ - will link to the literal string "{props.path}" */}
119+
{/* ❌ - will link to the literal string `{props.path}` */}
119120
[link]({props.path})
120121

121-
{/* ✅ - will link to "/foo/"" */}
122+
{/* ✅ - will link to `/foo/` */}
122123
<a href={props.path}>link</a>
123124
```
124125

125-
For this reason, the [`Markdown`](/style-guide/components/markdown/#example-for-variables-in-partials) component is available.
126+
For this reason, the [`Markdown`](/style-guide/components/markdown/#example-for-variables-in-partials) component is available.
127+
128+
```mdx
129+
---
130+
params:
131+
- name
132+
---
133+
134+
import { Markdown } from "~/components";
135+
136+
{/* If `params={{ name: "Cloudflare" }}` is passed, this will result in `Hello <strong>Cloudflare</strong>` */}
137+
{/* If `params={{ name: "NotCloudflare" }}` is passed, this will result in `Goodbye <strong>NotCloudflare</strong>` */}
138+
{ name === "Cloudflare" ? <Markdown text="Hello **Cloudflare**!"> : <Markdown text={`Goodbye **${name}**!`}> }
139+
```
140+
141+
More examples of using JSX are available in the [mdxjs.org documentation](https://mdxjs.com/docs/what-is-mdx/#expressions).

0 commit comments

Comments
 (0)