` to customize the document preview depending on each document settings. Since each document can have your own settings defined in the top of `.mdx` and the `Page` component receive a prop called `doc` that's the current rendered doc, you can use these settings to create page variations, like that:
226 |
227 | Let's suppose that some pages of your documentation should have a hero image, but some don't. You can give a `hero` property for your document, and base on that prop you'll show or not the hero:
228 |
229 | ```markdown
230 | ---
231 | name: Hello world
232 | hero: /my/hero/img.png
233 | ---
234 |
235 | # Hello world
236 |
237 | This is just a page!
238 | ```
239 |
240 | After defining the hero page of your document, let's see how your `Page` component will look:
241 |
242 | ```js
243 | import React from 'react'
244 |
245 | import MyCoolHero from './MyCoolHero'
246 |
247 | export const Page = ({ doc, children }) => (
248 |
249 | {doc.hero && }
250 | {children}
251 |
252 | )
253 | ```
254 |
255 | Simple as that! Now you can create a lot of variations of your documents page.
256 |
257 | How I told you, without pain and a lot of work your you can have a custom and very functional theme for your documentation. So, let's create your own theme and share with the community!
258 |
259 | ## Examples
260 |
261 | If you wanna see an example of theme created, you can see the [source code](https://github.com/pedronauck/docz-website) of this website that was entire build using docz or the [source code](https://github.com/pedronauck/docz/tree/master/packages/docz-theme-default) of `docz-theme-default`.
262 |
--------------------------------------------------------------------------------
/public/images/icons/settings.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
129 |
--------------------------------------------------------------------------------
/src/theme/components/ui/Loading.tsx:
--------------------------------------------------------------------------------
1 | import * as React from 'react'
2 | import styled, { css, keyframes } from 'react-emotion'
3 |
4 | const Wrapper = styled('div')`
5 | display: flex;
6 | align-items: center;
7 | justify-content: center;
8 | width: 100%;
9 | height: 100vh;
10 | `
11 |
12 | const dash = keyframes`
13 | to {
14 | stroke-dashoffset: 1000;
15 | }
16 | `
17 |
18 | const spinnerClass = (delay: number = 0) => css`
19 | stroke-dasharray: 100;
20 | animation: ${dash} 5s ${delay}s cubic-bezier(0.455, 0.03, 0.515, 0.955)
21 | infinite;
22 | `
23 |
24 | const Lines = styled('path')`
25 | stroke: ${p => p.theme.colors.primary};
26 | stroke-width: 3px;
27 | `
28 |
29 | const Path = styled('path')`
30 | fill: ${p => p.theme.colors.primary};
31 | `
32 |
33 | const Spinner = ({ size = 60 }) => (
34 |
83 | )
84 |
85 | export const Loading = () => (
86 |
87 |
88 |
89 | )
90 |
--------------------------------------------------------------------------------
/public/images/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------