From f10ac058b62e4b8b2c0e9043dbfcb7fe8ba004a3 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Fri, 9 Jun 2017 14:51:12 -0700 Subject: [PATCH] Add UIExplorer component for docs --- docs/storybook/UIExplorer.js | 84 ++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 docs/storybook/UIExplorer.js diff --git a/docs/storybook/UIExplorer.js b/docs/storybook/UIExplorer.js new file mode 100644 index 00000000..17765541 --- /dev/null +++ b/docs/storybook/UIExplorer.js @@ -0,0 +1,84 @@ +/* eslint-disable react/prop-types */ + +import React from 'react'; +import { StyleSheet, Text, View } from 'react-native'; + +/** + * Examples explorer + */ +const AppText = ({ style, ...rest }) => ; +const Link = ({ uri }) => + + API documentation + ; +const Title = ({ children }) => {children}; +const Description = ({ children }) => {children}; + +const Example = ({ example: { description, render, title } }) => + + {title} + {description && {description}} + {render && + + Example + {render()} + } + ; + +const UIExplorer = ({ description, examples, title, url }) => + + {title} + {description && {description}} + {url && } + {examples.map((example, i) => )} + ; + +const styles = StyleSheet.create({ + root: { + padding: '1rem', + flex: 1 + }, + baseText: { + fontFamily: + '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif, ' + + '"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"', // emoji fonts + lineHeight: '1.3125em' + }, + title: { + fontSize: '2rem' + }, + description: { + color: '#657786', + fontSize: '1.3125rem', + marginTop: 'calc(0.5 * 1.3125rem)' + }, + link: { + color: '#1B95E0', + marginTop: 'calc(0.5 * 1.3125rem)' + }, + example: { + marginTop: 'calc(2 * 1.3125rem)' + }, + exampleTitle: { + fontSize: '1.3125rem' + }, + exampleDescription: { + fontSize: '1rem', + marginTop: 'calc(0.5 * 1.3125rem)' + }, + exampleRenderBox: { + borderColor: '#E6ECF0', + borderWidth: 1, + padding: '1.3125rem', + marginTop: '1.3125rem' + }, + exampleText: { + color: '#AAB8C2', + fontSize: '0.8rem', + fontWeight: 'bold', + marginBottom: 'calc(0.5 * 1.3125rem)', + textTransform: 'uppercase' + } +}); + +export default UIExplorer;