File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
src/content/docs/style-guide/components Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -102,24 +102,40 @@ params:
102102
103103Generic 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
108109Within 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---
114115params:
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).
You can’t perform that action at this time.
0 commit comments