1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-12-01 21:42:08 +03:00
mdx-deck/docs/layouts.md

47 lines
971 B
Markdown
Raw Normal View History

2018-08-05 18:27:17 +03:00
# Layouts
Each slide can include a custom layout around its content.
This can be used as a substitute for slide templates found in other presentation apps and libraries.
```js
// example Layout.js
import React from 'react'
export default ({ children }) => (
2018-08-05 18:27:17 +03:00
<div
style={{
width: '100vw',
height: '100vw',
backgroundColor: 'tomato',
}}
>
2018-08-05 18:27:17 +03:00
{children}
</div>
)
2018-08-05 18:27:17 +03:00
```
```mdx
import Layout from './Layout'
# No Layout
---
<Layout>
2018-08-05 18:27:17 +03:00
# Custom Layout
</Layout>
2018-08-05 18:27:17 +03:00
```
The layout component will wrap the MDX elements within that slide,
which means you can use a nested ThemeProvider or target elements with CSS-in-JS.
**NOTE:** The newlines around child content in the layout component is **required** to use markdown syntax in a layout. Otherwise the content will be parsed as raw text.
2018-08-05 18:27:17 +03:00
## Built-in Layouts
mdx-deck includes a few built-in layouts for common slide variations.
See the [Components docs](components.md#layouts) for more.