From 546bf814ca51201b7e14fbdcf30278216b45cb96 Mon Sep 17 00:00:00 2001 From: kuzhelov Date: Mon, 21 Jan 2019 17:24:59 +0100 Subject: [PATCH 01/11] refine shorthand docs --- docs/src/views/ShorthandProps.tsx | 260 ++++++++++++++++++++++++++++-- 1 file changed, 243 insertions(+), 17 deletions(-) diff --git a/docs/src/views/ShorthandProps.tsx b/docs/src/views/ShorthandProps.tsx index af300df509..fdc60d3bd3 100644 --- a/docs/src/views/ShorthandProps.tsx +++ b/docs/src/views/ShorthandProps.tsx @@ -1,37 +1,263 @@ import * as React from 'react' import { NavLink } from 'react-router-dom' +import { Header } from 'semantic-ui-react' import DocPage from '../components/DocPage/DocPage' import CodeSnippet from '../components/CodeSnippet' import Button from '../../../src/components/Button/Button' +const joinToString = stringOrArray => { + if (typeof stringOrArray === 'string') { + return stringOrArray + } + + return stringOrArray.join('\n') +} + +const header = content =>
{content}
+const subheader = content =>
{content}
+ +const code = content => {content} +const codeExample = snippet => + class ShorthandProps extends React.Component { render() { return (

- Most components support two APIs: shorthand and children. With - the shorthand definition we are adding some props to the component in order - to define it’s content and behavior. + It is quite common for Stardust component to have "slots" which accept shorthand values. + For example, {code('Button')} component has an {code('icon')} slot which value defines the + icon that will be rendered. +

+ + {codeExample([``, - ].join('\n')} - /> + + {codeExample([`