@storybook/react-native-web-vite 0.0.0-pr-29520-sha-80319502
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.d.ts +52 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/dist/preset.d.ts +13 -0
- package/dist/preset.js +1 -0
- package/package.json +88 -0
- package/preset.js +1 -0
- package/template/cli/.eslintrc.json +6 -0
- package/template/cli/ts-3-8/Button.stories.tsx +46 -0
- package/template/cli/ts-3-8/Button.tsx +124 -0
- package/template/cli/ts-3-8/Header.stories.tsx +28 -0
- package/template/cli/ts-3-8/Header.tsx +83 -0
- package/template/cli/ts-3-8/Page.stories.tsx +20 -0
- package/template/cli/ts-3-8/Page.tsx +168 -0
- package/template/cli/ts-4-9/Button.stories.tsx +46 -0
- package/template/cli/ts-4-9/Button.tsx +124 -0
- package/template/cli/ts-4-9/Header.stories.tsx +28 -0
- package/template/cli/ts-4-9/Header.tsx +81 -0
- package/template/cli/ts-4-9/Page.stories.tsx +16 -0
- package/template/cli/ts-4-9/Page.tsx +160 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { StorybookConfig as StorybookConfig$1, TypescriptOptions as TypescriptOptions$1, CompatibleString } from 'storybook/internal/types';
|
|
2
|
+
import { BuilderOptions, StorybookConfigVite } from '@storybook/builder-vite';
|
|
3
|
+
import docgenTypescript from '@joshwooding/vite-plugin-react-docgen-typescript';
|
|
4
|
+
import { Options, BabelOptions } from '@vitejs/plugin-react';
|
|
5
|
+
|
|
6
|
+
type FrameworkName = CompatibleString<'@storybook/react-native-web-vite'>;
|
|
7
|
+
type BuilderName = CompatibleString<'@storybook/builder-vite'>;
|
|
8
|
+
type FrameworkOptions = {
|
|
9
|
+
builder?: BuilderOptions;
|
|
10
|
+
strictMode?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Use React's legacy root API to mount components
|
|
13
|
+
*
|
|
14
|
+
* React has introduced a new root API with React 18.x to enable a whole set of new features (e.g.
|
|
15
|
+
* concurrent features) If this flag is true, the legacy Root API is used to mount components to
|
|
16
|
+
* make it easier to migrate step by step to React 18.
|
|
17
|
+
*
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
legacyRootApi?: boolean;
|
|
21
|
+
pluginReactOptions?: Omit<Options, 'babel'> & {
|
|
22
|
+
babel?: BabelOptions;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
type StorybookConfigFramework = {
|
|
26
|
+
framework: FrameworkName | {
|
|
27
|
+
name: FrameworkName;
|
|
28
|
+
options: FrameworkOptions;
|
|
29
|
+
};
|
|
30
|
+
core?: StorybookConfig$1['core'] & {
|
|
31
|
+
builder?: BuilderName | {
|
|
32
|
+
name: BuilderName;
|
|
33
|
+
options: BuilderOptions;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
type TypescriptOptions = TypescriptOptions$1 & {
|
|
38
|
+
/**
|
|
39
|
+
* Sets the type of Docgen when working with React and TypeScript
|
|
40
|
+
*
|
|
41
|
+
* @default `'react-docgen'`
|
|
42
|
+
*/
|
|
43
|
+
reactDocgen: 'react-docgen-typescript' | 'react-docgen' | false;
|
|
44
|
+
/** Configures `@joshwooding/vite-plugin-react-docgen-typescript` */
|
|
45
|
+
reactDocgenTypescriptOptions: Parameters<typeof docgenTypescript>[0];
|
|
46
|
+
};
|
|
47
|
+
/** The interface for Storybook configuration in `main.ts` files. */
|
|
48
|
+
type StorybookConfig = Omit<StorybookConfig$1, keyof StorybookConfigVite | keyof StorybookConfigFramework | 'typescript'> & StorybookConfigVite & StorybookConfigFramework & {
|
|
49
|
+
typescript?: Partial<TypescriptOptions>;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export { FrameworkOptions, StorybookConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var src_exports={};module.exports=__toCommonJS(src_exports);
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/preset.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StorybookConfig } from './index.js';
|
|
2
|
+
import 'storybook/internal/types';
|
|
3
|
+
import '@storybook/builder-vite';
|
|
4
|
+
import '@joshwooding/vite-plugin-react-docgen-typescript';
|
|
5
|
+
import '@vitejs/plugin-react';
|
|
6
|
+
|
|
7
|
+
declare const viteFinal: StorybookConfig['viteFinal'];
|
|
8
|
+
declare const core: {
|
|
9
|
+
builder: string;
|
|
10
|
+
renderer: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { core, viteFinal };
|
package/dist/preset.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var preset_exports={};__export(preset_exports,{core:()=>core,viteFinal:()=>viteFinal});module.exports=__toCommonJS(preset_exports);var import_plugin_react=__toESM(require("@vitejs/plugin-react"));function reactNativeWeb(reactOptions){return{name:"vite:react-native-web",config(_userConfig,env){return{define:{"global.__x":{},_frameTimestamp:void 0,_WORKLET:!1,__DEV__:`${env.mode==="development"}`,"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||env.mode)},optimizeDeps:{include:[],esbuildOptions:{jsx:"transform",resolveExtensions:[".web.js",".web.ts",".web.tsx",".js",".jsx",".json",".ts",".tsx",".mjs"],loader:{".js":"jsx"}}},resolve:{extensions:[".web.js",".web.ts",".web.tsx",".js",".jsx",".json",".ts",".tsx",".mjs"],alias:{"react-native":"react-native-web"}}}}}}var viteFinal=async(config,options)=>{let{pluginReactOptions={}}=await options.presets.apply("frameworkOptions"),{plugins=[]}=config;return plugins.push((0,import_plugin_react.default)({babel:{babelrc:!1,configFile:!1},jsxRuntime:"automatic",...pluginReactOptions})),plugins.push(reactNativeWeb(pluginReactOptions)),config},core={builder:"@storybook/builder-vite",renderer:"@storybook/react"};0&&(module.exports={core,viteFinal});
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@storybook/react-native-web-vite",
|
|
3
|
+
"version": "0.0.0-pr-29520-sha-80319502",
|
|
4
|
+
"description": "Develop react-native components an isolated web environment with hot reloading.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"storybook"
|
|
7
|
+
],
|
|
8
|
+
"homepage": "https://github.com/storybookjs/storybook/tree/next/code/frameworks/react-native-web-vite",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/storybookjs/storybook/issues"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/storybookjs/storybook.git",
|
|
15
|
+
"directory": "code/frameworks/react-native-web-vite"
|
|
16
|
+
},
|
|
17
|
+
"funding": {
|
|
18
|
+
"type": "opencollective",
|
|
19
|
+
"url": "https://opencollective.com/storybook"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"node": "./dist/index.js",
|
|
26
|
+
"import": "./dist/index.mjs",
|
|
27
|
+
"require": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./preset": {
|
|
30
|
+
"types": "./dist/preset.d.ts",
|
|
31
|
+
"require": "./dist/preset.js"
|
|
32
|
+
},
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"main": "dist/index.js",
|
|
36
|
+
"module": "dist/index.mjs",
|
|
37
|
+
"types": "dist/index.d.ts",
|
|
38
|
+
"files": [
|
|
39
|
+
"dist/**/*",
|
|
40
|
+
"template/cli/**/*",
|
|
41
|
+
"README.md",
|
|
42
|
+
"*.js",
|
|
43
|
+
"*.d.ts",
|
|
44
|
+
"!src/**/*"
|
|
45
|
+
],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"check": "jiti ../../../scripts/prepare/check.ts",
|
|
48
|
+
"prep": "jiti ../../../scripts/prepare/bundle.ts"
|
|
49
|
+
},
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@joshwooding/vite-plugin-react-docgen-typescript": "0.3.0",
|
|
52
|
+
"@rollup/pluginutils": "^5.0.2",
|
|
53
|
+
"@storybook/builder-vite": "0.0.0-pr-29520-sha-80319502",
|
|
54
|
+
"@storybook/react": "0.0.0-pr-29520-sha-80319502",
|
|
55
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
56
|
+
"find-up": "^5.0.0",
|
|
57
|
+
"magic-string": "^0.30.0",
|
|
58
|
+
"react-docgen": "^7.0.0",
|
|
59
|
+
"resolve": "^1.22.8",
|
|
60
|
+
"tsconfig-paths": "^4.2.0"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@types/node": "^22.0.0",
|
|
64
|
+
"typescript": "^5.3.2"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
|
|
68
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0-beta",
|
|
69
|
+
"react-native": ">=0.74.5",
|
|
70
|
+
"react-native-web": "^0.19.12",
|
|
71
|
+
"storybook": "^0.0.0-pr-29520-sha-80319502",
|
|
72
|
+
"vite": "^4.0.0 || ^5.0.0"
|
|
73
|
+
},
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": ">=18.0.0"
|
|
76
|
+
},
|
|
77
|
+
"publishConfig": {
|
|
78
|
+
"access": "public"
|
|
79
|
+
},
|
|
80
|
+
"bundler": {
|
|
81
|
+
"entries": [
|
|
82
|
+
"./src/index.ts",
|
|
83
|
+
"./src/preset.ts"
|
|
84
|
+
],
|
|
85
|
+
"platform": "node"
|
|
86
|
+
},
|
|
87
|
+
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16"
|
|
88
|
+
}
|
package/preset.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/preset');
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Button } from './Button';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Button> = {
|
|
7
|
+
component: Button,
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<View style={{ flex: 1, alignItems: 'flex-start' }}>
|
|
11
|
+
<Story />
|
|
12
|
+
</View>
|
|
13
|
+
),
|
|
14
|
+
],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
export const Primary: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
primary: true,
|
|
24
|
+
label: 'Button',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Secondary: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
label: 'Button',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Large: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
size: 'large',
|
|
37
|
+
label: 'Button',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Small: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
size: 'small',
|
|
44
|
+
label: 'Button',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StyleSheet,
|
|
3
|
+
StyleProp,
|
|
4
|
+
ViewStyle,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
Text,
|
|
7
|
+
View,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
|
|
11
|
+
export interface ButtonProps {
|
|
12
|
+
/**
|
|
13
|
+
* Is this the principal call to action on the page?
|
|
14
|
+
*/
|
|
15
|
+
primary?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* What background color to use
|
|
18
|
+
*/
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
/**
|
|
21
|
+
* How large should the button be?
|
|
22
|
+
*/
|
|
23
|
+
size?: 'small' | 'medium' | 'large';
|
|
24
|
+
/**
|
|
25
|
+
* Button contents
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional click handler
|
|
30
|
+
*/
|
|
31
|
+
onPress?: () => void;
|
|
32
|
+
style?: StyleProp<ViewStyle>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Primary UI component for user interaction
|
|
37
|
+
*/
|
|
38
|
+
export const Button = ({
|
|
39
|
+
primary = false,
|
|
40
|
+
size = 'medium',
|
|
41
|
+
backgroundColor,
|
|
42
|
+
label,
|
|
43
|
+
style,
|
|
44
|
+
onPress,
|
|
45
|
+
}: ButtonProps) => {
|
|
46
|
+
const modeStyle = primary ? styles.primary : styles.secondary;
|
|
47
|
+
const textModeStyle = primary ? styles.primaryText : styles.secondaryText;
|
|
48
|
+
|
|
49
|
+
const sizeStyle = styles[size];
|
|
50
|
+
const textSizeStyle = textSizeStyles[size];
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<TouchableOpacity
|
|
54
|
+
accessibilityRole='button'
|
|
55
|
+
activeOpacity={0.6}
|
|
56
|
+
onPress={onPress}
|
|
57
|
+
>
|
|
58
|
+
<View
|
|
59
|
+
style={[
|
|
60
|
+
styles.button,
|
|
61
|
+
modeStyle,
|
|
62
|
+
sizeStyle,
|
|
63
|
+
style,
|
|
64
|
+
!!backgroundColor && { backgroundColor },
|
|
65
|
+
{ borderColor: 'black' },
|
|
66
|
+
]}
|
|
67
|
+
>
|
|
68
|
+
<Text style={[textModeStyle, textSizeStyle]}>{label}</Text>
|
|
69
|
+
</View>
|
|
70
|
+
</TouchableOpacity>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const styles = StyleSheet.create({
|
|
75
|
+
button: {
|
|
76
|
+
borderWidth: 0,
|
|
77
|
+
borderRadius: 48,
|
|
78
|
+
},
|
|
79
|
+
buttonText: {
|
|
80
|
+
fontWeight: '700',
|
|
81
|
+
lineHeight: 1,
|
|
82
|
+
},
|
|
83
|
+
primary: {
|
|
84
|
+
backgroundColor: '#1ea7fd',
|
|
85
|
+
},
|
|
86
|
+
primaryText: {
|
|
87
|
+
color: 'white',
|
|
88
|
+
},
|
|
89
|
+
secondary: {
|
|
90
|
+
backgroundColor: 'transparent',
|
|
91
|
+
borderColor: 'rgba(0, 0, 0, 0.15)',
|
|
92
|
+
borderWidth: 1,
|
|
93
|
+
},
|
|
94
|
+
secondaryText: {
|
|
95
|
+
color: '#333',
|
|
96
|
+
},
|
|
97
|
+
small: {
|
|
98
|
+
paddingVertical: 10,
|
|
99
|
+
paddingHorizontal: 16,
|
|
100
|
+
},
|
|
101
|
+
smallText: {
|
|
102
|
+
fontSize: 12,
|
|
103
|
+
},
|
|
104
|
+
medium: {
|
|
105
|
+
paddingVertical: 11,
|
|
106
|
+
paddingHorizontal: 20,
|
|
107
|
+
},
|
|
108
|
+
mediumText: {
|
|
109
|
+
fontSize: 14,
|
|
110
|
+
},
|
|
111
|
+
large: {
|
|
112
|
+
paddingVertical: 12,
|
|
113
|
+
paddingHorizontal: 24,
|
|
114
|
+
},
|
|
115
|
+
largeText: {
|
|
116
|
+
fontSize: 16,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const textSizeStyles = {
|
|
121
|
+
small: styles.smallText,
|
|
122
|
+
medium: styles.mediumText,
|
|
123
|
+
large: styles.largeText,
|
|
124
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Header } from './Header';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Header> = {
|
|
6
|
+
component: Header,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const LoggedIn: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
user: {},
|
|
16
|
+
onLogin: () => {},
|
|
17
|
+
onLogout: () => {},
|
|
18
|
+
onCreateAccount: () => {},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const LoggedOut: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
onLogin: () => {},
|
|
25
|
+
onLogout: () => {},
|
|
26
|
+
onCreateAccount: () => {},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Button } from './Button';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
export type HeaderProps = {
|
|
6
|
+
user?: {};
|
|
7
|
+
onLogin: () => void;
|
|
8
|
+
onLogout: () => void;
|
|
9
|
+
onCreateAccount: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Header = ({
|
|
13
|
+
user,
|
|
14
|
+
onLogin,
|
|
15
|
+
onLogout,
|
|
16
|
+
onCreateAccount,
|
|
17
|
+
}: HeaderProps) => (
|
|
18
|
+
<View>
|
|
19
|
+
<View style={styles.wrapper}>
|
|
20
|
+
<View style={styles.logoContainer}>
|
|
21
|
+
<Text style={styles.h1}>Acme</Text>
|
|
22
|
+
</View>
|
|
23
|
+
|
|
24
|
+
<View style={styles.buttonContainer}>
|
|
25
|
+
{user ? (
|
|
26
|
+
<Button
|
|
27
|
+
style={styles.button}
|
|
28
|
+
size='small'
|
|
29
|
+
onPress={onLogout}
|
|
30
|
+
label='Log out'
|
|
31
|
+
/>
|
|
32
|
+
) : (
|
|
33
|
+
<>
|
|
34
|
+
<Button
|
|
35
|
+
style={styles.button}
|
|
36
|
+
size='small'
|
|
37
|
+
onPress={onLogin}
|
|
38
|
+
label='Log in'
|
|
39
|
+
/>
|
|
40
|
+
|
|
41
|
+
<Button
|
|
42
|
+
style={styles.button}
|
|
43
|
+
primary
|
|
44
|
+
size='small'
|
|
45
|
+
onPress={onCreateAccount}
|
|
46
|
+
label='Sign up'
|
|
47
|
+
/>
|
|
48
|
+
</>
|
|
49
|
+
)}
|
|
50
|
+
</View>
|
|
51
|
+
</View>
|
|
52
|
+
</View>
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const styles = StyleSheet.create({
|
|
56
|
+
wrapper: {
|
|
57
|
+
borderBottomWidth: 1,
|
|
58
|
+
borderBottomColor: 'rgba(0, 0, 0, 0.1)',
|
|
59
|
+
paddingVertical: 15,
|
|
60
|
+
paddingHorizontal: 20,
|
|
61
|
+
flexDirection: 'row',
|
|
62
|
+
justifyContent: 'space-between',
|
|
63
|
+
},
|
|
64
|
+
h1: {
|
|
65
|
+
fontWeight: '900',
|
|
66
|
+
fontSize: 20,
|
|
67
|
+
marginTop: 6,
|
|
68
|
+
marginBottom: 6,
|
|
69
|
+
marginLeft: 10,
|
|
70
|
+
color: 'black',
|
|
71
|
+
alignSelf: 'flex-start',
|
|
72
|
+
},
|
|
73
|
+
logoContainer: {
|
|
74
|
+
flexDirection: 'row',
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
},
|
|
77
|
+
button: {
|
|
78
|
+
marginLeft: 10,
|
|
79
|
+
},
|
|
80
|
+
buttonContainer: {
|
|
81
|
+
flexDirection: 'row',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import * as HeaderStories from './Header.stories';
|
|
3
|
+
import { Page } from './Page';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Page> = {
|
|
7
|
+
component: Page,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default meta;
|
|
11
|
+
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
|
|
14
|
+
export const LoggedIn: Story = {
|
|
15
|
+
args: HeaderStories.LoggedIn.args,
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const LoggedOut: Story = {
|
|
19
|
+
args: HeaderStories.LoggedOut.args,
|
|
20
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { View, Text, StyleSheet, Linking } from 'react-native';
|
|
2
|
+
import { Header } from './Header';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
export type PageProps = {
|
|
6
|
+
user?: {};
|
|
7
|
+
onLogin: () => void;
|
|
8
|
+
onLogout: () => void;
|
|
9
|
+
onCreateAccount: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Page = ({
|
|
13
|
+
user,
|
|
14
|
+
onLogin,
|
|
15
|
+
onLogout,
|
|
16
|
+
onCreateAccount,
|
|
17
|
+
}: PageProps) => (
|
|
18
|
+
<View>
|
|
19
|
+
<Header
|
|
20
|
+
user={user}
|
|
21
|
+
onLogin={onLogin}
|
|
22
|
+
onLogout={onLogout}
|
|
23
|
+
onCreateAccount={onCreateAccount}
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
<View style={styles.section}>
|
|
27
|
+
<Text role='heading' style={styles.h2}>
|
|
28
|
+
Pages in Storybook
|
|
29
|
+
</Text>
|
|
30
|
+
|
|
31
|
+
<Text style={styles.p}>
|
|
32
|
+
We recommend building UIs with a{' '}
|
|
33
|
+
<Text
|
|
34
|
+
style={[styles.a, { fontWeight: 'bold' }]}
|
|
35
|
+
role='link'
|
|
36
|
+
onPress={() => {
|
|
37
|
+
Linking.openURL('https://componentdriven.org');
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
<Text>component-driven</Text>
|
|
41
|
+
</Text>{' '}
|
|
42
|
+
process starting with atomic components and ending with pages.
|
|
43
|
+
</Text>
|
|
44
|
+
|
|
45
|
+
<Text style={styles.p}>
|
|
46
|
+
Render pages with mock data. This makes it easy to build and review page
|
|
47
|
+
states without needing to navigate to them in your app. Here are some
|
|
48
|
+
handy patterns for managing page data in Storybook:
|
|
49
|
+
</Text>
|
|
50
|
+
|
|
51
|
+
<View>
|
|
52
|
+
<View>
|
|
53
|
+
Use a higher-level connected component. Storybook helps you compose
|
|
54
|
+
such data from the "args" of child component stories
|
|
55
|
+
</View>
|
|
56
|
+
|
|
57
|
+
<View>
|
|
58
|
+
Assemble data in the page component from your services. You can mock
|
|
59
|
+
these services out using Storybook.
|
|
60
|
+
</View>
|
|
61
|
+
</View>
|
|
62
|
+
|
|
63
|
+
<Text style={styles.p}>
|
|
64
|
+
Get a guided tutorial on component-driven development at{' '}
|
|
65
|
+
<Text
|
|
66
|
+
style={styles.a}
|
|
67
|
+
role='link'
|
|
68
|
+
onPress={() => {
|
|
69
|
+
Linking.openURL('https://storybook.js.org/tutorials/');
|
|
70
|
+
}}
|
|
71
|
+
>
|
|
72
|
+
Storybook tutorials
|
|
73
|
+
</Text>
|
|
74
|
+
. Read more in the{' '}
|
|
75
|
+
<Text
|
|
76
|
+
style={styles.a}
|
|
77
|
+
role='link'
|
|
78
|
+
onPress={() => {
|
|
79
|
+
Linking.openURL('https://storybook.js.org/docs');
|
|
80
|
+
}}
|
|
81
|
+
>
|
|
82
|
+
docs
|
|
83
|
+
</Text>
|
|
84
|
+
.
|
|
85
|
+
</Text>
|
|
86
|
+
|
|
87
|
+
<View style={styles.tipWrapper}>
|
|
88
|
+
<View style={styles.tip}>
|
|
89
|
+
<Text style={styles.tipText}>Tip </Text>
|
|
90
|
+
</View>
|
|
91
|
+
|
|
92
|
+
<Text>Adjust the width of the canvas with the </Text>
|
|
93
|
+
|
|
94
|
+
<Text>Viewports addon in the toolbar</Text>
|
|
95
|
+
</View>
|
|
96
|
+
</View>
|
|
97
|
+
</View>
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const styles = StyleSheet.create({
|
|
101
|
+
section: {
|
|
102
|
+
fontFamily: "'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
|
103
|
+
fontSize: 14,
|
|
104
|
+
lineHeight: 24,
|
|
105
|
+
paddingVertical: 48,
|
|
106
|
+
paddingHorizontal: 20,
|
|
107
|
+
marginHorizontal: 'auto',
|
|
108
|
+
maxWidth: 600,
|
|
109
|
+
color: '#333',
|
|
110
|
+
},
|
|
111
|
+
|
|
112
|
+
h2: {
|
|
113
|
+
fontWeight: '900',
|
|
114
|
+
fontSize: 32,
|
|
115
|
+
lineHeight: 1,
|
|
116
|
+
marginBottom: 4,
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
p: {
|
|
120
|
+
marginVertical: 16,
|
|
121
|
+
marginHorizontal: 0,
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
a: {
|
|
125
|
+
color: '#1ea7fd',
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
ul: {
|
|
129
|
+
paddingLeft: 30,
|
|
130
|
+
marginVertical: 16,
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
li: {
|
|
134
|
+
marginBottom: 8,
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
tip: {
|
|
138
|
+
alignSelf: 'flex-start',
|
|
139
|
+
borderRadius: 16,
|
|
140
|
+
backgroundColor: '#e7fdd8',
|
|
141
|
+
paddingVertical: 4,
|
|
142
|
+
paddingHorizontal: 12,
|
|
143
|
+
marginRight: 10,
|
|
144
|
+
marginBottom: 4,
|
|
145
|
+
},
|
|
146
|
+
tipText: {
|
|
147
|
+
fontSize: 11,
|
|
148
|
+
lineHeight: 12,
|
|
149
|
+
fontWeight: '700',
|
|
150
|
+
color: '#66bf3c',
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
tipWrapper: {
|
|
154
|
+
fontSize: 13,
|
|
155
|
+
lineHeight: 20,
|
|
156
|
+
marginTop: 40,
|
|
157
|
+
marginBottom: 40,
|
|
158
|
+
flexDirection: 'row',
|
|
159
|
+
flexWrap: 'wrap',
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
tipWrapperSvg: {
|
|
163
|
+
height: 12,
|
|
164
|
+
width: 12,
|
|
165
|
+
marginRight: 4,
|
|
166
|
+
marginTop: 3,
|
|
167
|
+
},
|
|
168
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Button } from './Button';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
component: Button,
|
|
8
|
+
decorators: [
|
|
9
|
+
(Story) => (
|
|
10
|
+
<View style={{ flex: 1, alignItems: 'flex-start' }}>
|
|
11
|
+
<Story />
|
|
12
|
+
</View>
|
|
13
|
+
),
|
|
14
|
+
],
|
|
15
|
+
} satisfies Meta<typeof Button>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
export const Primary: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
primary: true,
|
|
24
|
+
label: 'Button',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const Secondary: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
label: 'Button',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Large: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
size: 'large',
|
|
37
|
+
label: 'Button',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Small: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
size: 'small',
|
|
44
|
+
label: 'Button',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import {
|
|
2
|
+
StyleSheet,
|
|
3
|
+
StyleProp,
|
|
4
|
+
ViewStyle,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
Text,
|
|
7
|
+
View,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
|
|
11
|
+
export interface ButtonProps {
|
|
12
|
+
/**
|
|
13
|
+
* Is this the principal call to action on the page?
|
|
14
|
+
*/
|
|
15
|
+
primary?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* What background color to use
|
|
18
|
+
*/
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
/**
|
|
21
|
+
* How large should the button be?
|
|
22
|
+
*/
|
|
23
|
+
size?: 'small' | 'medium' | 'large';
|
|
24
|
+
/**
|
|
25
|
+
* Button contents
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
/**
|
|
29
|
+
* Optional click handler
|
|
30
|
+
*/
|
|
31
|
+
onPress?: () => void;
|
|
32
|
+
style?: StyleProp<ViewStyle>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Primary UI component for user interaction
|
|
37
|
+
*/
|
|
38
|
+
export const Button = ({
|
|
39
|
+
primary = false,
|
|
40
|
+
size = 'medium',
|
|
41
|
+
backgroundColor,
|
|
42
|
+
label,
|
|
43
|
+
style,
|
|
44
|
+
onPress,
|
|
45
|
+
}: ButtonProps) => {
|
|
46
|
+
const modeStyle = primary ? styles.primary : styles.secondary;
|
|
47
|
+
const textModeStyle = primary ? styles.primaryText : styles.secondaryText;
|
|
48
|
+
|
|
49
|
+
const sizeStyle = styles[size];
|
|
50
|
+
const textSizeStyle = textSizeStyles[size];
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<TouchableOpacity
|
|
54
|
+
accessibilityRole='button'
|
|
55
|
+
activeOpacity={0.6}
|
|
56
|
+
onPress={onPress}
|
|
57
|
+
>
|
|
58
|
+
<View
|
|
59
|
+
style={[
|
|
60
|
+
styles.button,
|
|
61
|
+
modeStyle,
|
|
62
|
+
sizeStyle,
|
|
63
|
+
style,
|
|
64
|
+
!!backgroundColor && { backgroundColor },
|
|
65
|
+
{ borderColor: 'black' },
|
|
66
|
+
]}
|
|
67
|
+
>
|
|
68
|
+
<Text style={[textModeStyle, textSizeStyle]}>{label}</Text>
|
|
69
|
+
</View>
|
|
70
|
+
</TouchableOpacity>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const styles = StyleSheet.create({
|
|
75
|
+
button: {
|
|
76
|
+
borderWidth: 0,
|
|
77
|
+
borderRadius: 48,
|
|
78
|
+
},
|
|
79
|
+
buttonText: {
|
|
80
|
+
fontWeight: '700',
|
|
81
|
+
lineHeight: 1,
|
|
82
|
+
},
|
|
83
|
+
primary: {
|
|
84
|
+
backgroundColor: '#1ea7fd',
|
|
85
|
+
},
|
|
86
|
+
primaryText: {
|
|
87
|
+
color: 'white',
|
|
88
|
+
},
|
|
89
|
+
secondary: {
|
|
90
|
+
backgroundColor: 'transparent',
|
|
91
|
+
borderColor: 'rgba(0, 0, 0, 0.15)',
|
|
92
|
+
borderWidth: 1,
|
|
93
|
+
},
|
|
94
|
+
secondaryText: {
|
|
95
|
+
color: '#333',
|
|
96
|
+
},
|
|
97
|
+
small: {
|
|
98
|
+
paddingVertical: 10,
|
|
99
|
+
paddingHorizontal: 16,
|
|
100
|
+
},
|
|
101
|
+
smallText: {
|
|
102
|
+
fontSize: 12,
|
|
103
|
+
},
|
|
104
|
+
medium: {
|
|
105
|
+
paddingVertical: 11,
|
|
106
|
+
paddingHorizontal: 20,
|
|
107
|
+
},
|
|
108
|
+
mediumText: {
|
|
109
|
+
fontSize: 14,
|
|
110
|
+
},
|
|
111
|
+
large: {
|
|
112
|
+
paddingVertical: 12,
|
|
113
|
+
paddingHorizontal: 24,
|
|
114
|
+
},
|
|
115
|
+
largeText: {
|
|
116
|
+
fontSize: 16,
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const textSizeStyles = {
|
|
121
|
+
small: styles.smallText,
|
|
122
|
+
medium: styles.mediumText,
|
|
123
|
+
large: styles.largeText,
|
|
124
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { Header } from './Header';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
component: Header,
|
|
7
|
+
} satisfies Meta<typeof Header>;
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
|
|
11
|
+
type Story = StoryObj<typeof meta>;
|
|
12
|
+
|
|
13
|
+
export const LoggedIn: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
user: {},
|
|
16
|
+
onLogin: () => {},
|
|
17
|
+
onLogout: () => {},
|
|
18
|
+
onCreateAccount: () => {},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const LoggedOut: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
onLogin: () => {},
|
|
25
|
+
onLogout: () => {},
|
|
26
|
+
onCreateAccount: () => {},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Button } from './Button';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
export type HeaderProps = {
|
|
6
|
+
user?: {};
|
|
7
|
+
onLogin: () => void;
|
|
8
|
+
onLogout: () => void;
|
|
9
|
+
onCreateAccount: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Header = ({
|
|
13
|
+
user,
|
|
14
|
+
onLogin,
|
|
15
|
+
onLogout,
|
|
16
|
+
onCreateAccount,
|
|
17
|
+
}: HeaderProps) => (
|
|
18
|
+
<View>
|
|
19
|
+
<View style={styles.wrapper}>
|
|
20
|
+
<View style={styles.logoContainer}>
|
|
21
|
+
<Text style={styles.h1}>Acme</Text>
|
|
22
|
+
</View>
|
|
23
|
+
<View style={styles.buttonContainer}>
|
|
24
|
+
{user ? (
|
|
25
|
+
<Button
|
|
26
|
+
style={styles.button}
|
|
27
|
+
size='small'
|
|
28
|
+
onPress={onLogout}
|
|
29
|
+
label='Log out'
|
|
30
|
+
/>
|
|
31
|
+
) : (
|
|
32
|
+
<>
|
|
33
|
+
<Button
|
|
34
|
+
style={styles.button}
|
|
35
|
+
size='small'
|
|
36
|
+
onPress={onLogin}
|
|
37
|
+
label='Log in'
|
|
38
|
+
/>
|
|
39
|
+
<Button
|
|
40
|
+
style={styles.button}
|
|
41
|
+
primary
|
|
42
|
+
size='small'
|
|
43
|
+
onPress={onCreateAccount}
|
|
44
|
+
label='Sign up'
|
|
45
|
+
/>
|
|
46
|
+
</>
|
|
47
|
+
)}
|
|
48
|
+
</View>
|
|
49
|
+
</View>
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const styles = StyleSheet.create({
|
|
54
|
+
wrapper: {
|
|
55
|
+
borderBottomWidth: 1,
|
|
56
|
+
borderBottomColor: 'rgba(0, 0, 0, 0.1)',
|
|
57
|
+
paddingVertical: 15,
|
|
58
|
+
paddingHorizontal: 20,
|
|
59
|
+
flexDirection: 'row',
|
|
60
|
+
justifyContent: 'space-between',
|
|
61
|
+
},
|
|
62
|
+
h1: {
|
|
63
|
+
fontWeight: '900',
|
|
64
|
+
fontSize: 20,
|
|
65
|
+
marginTop: 6,
|
|
66
|
+
marginBottom: 6,
|
|
67
|
+
marginLeft: 10,
|
|
68
|
+
color: 'black',
|
|
69
|
+
alignSelf: 'flex-start',
|
|
70
|
+
},
|
|
71
|
+
logoContainer: {
|
|
72
|
+
flexDirection: 'row',
|
|
73
|
+
alignItems: 'center',
|
|
74
|
+
},
|
|
75
|
+
button: {
|
|
76
|
+
marginLeft: 10,
|
|
77
|
+
},
|
|
78
|
+
buttonContainer: {
|
|
79
|
+
flexDirection: 'row',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react';
|
|
2
|
+
import * as HeaderStories from './Header.stories';
|
|
3
|
+
import { Page } from './Page';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
component: Page,
|
|
8
|
+
} as Meta<typeof Page>;
|
|
9
|
+
|
|
10
|
+
export const LoggedIn = {
|
|
11
|
+
args: HeaderStories.LoggedIn.args,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const LoggedOut = {
|
|
15
|
+
args: HeaderStories.LoggedOut.args,
|
|
16
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { View, Text, StyleSheet, Linking } from 'react-native';
|
|
2
|
+
import { Header } from './Header';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
|
|
5
|
+
export type PageProps = {
|
|
6
|
+
user?: {};
|
|
7
|
+
onLogin: () => void;
|
|
8
|
+
onLogout: () => void;
|
|
9
|
+
onCreateAccount: () => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Page = ({
|
|
13
|
+
user,
|
|
14
|
+
onLogin,
|
|
15
|
+
onLogout,
|
|
16
|
+
onCreateAccount,
|
|
17
|
+
}: PageProps) => (
|
|
18
|
+
<View>
|
|
19
|
+
<Header
|
|
20
|
+
user={user}
|
|
21
|
+
onLogin={onLogin}
|
|
22
|
+
onLogout={onLogout}
|
|
23
|
+
onCreateAccount={onCreateAccount}
|
|
24
|
+
/>
|
|
25
|
+
|
|
26
|
+
<View style={styles.section}>
|
|
27
|
+
<Text role='heading' style={styles.h2}>
|
|
28
|
+
Pages in Storybook
|
|
29
|
+
</Text>
|
|
30
|
+
<Text style={styles.p}>
|
|
31
|
+
We recommend building UIs with a{' '}
|
|
32
|
+
<Text
|
|
33
|
+
style={[styles.a, { fontWeight: 'bold' }]}
|
|
34
|
+
role='link'
|
|
35
|
+
onPress={() => {
|
|
36
|
+
Linking.openURL('https://componentdriven.org');
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
<Text>component-driven</Text>
|
|
40
|
+
</Text>{' '}
|
|
41
|
+
process starting with atomic components and ending with pages.
|
|
42
|
+
</Text>
|
|
43
|
+
<Text style={styles.p}>
|
|
44
|
+
Render pages with mock data. This makes it easy to build and review page
|
|
45
|
+
states without needing to navigate to them in your app. Here are some
|
|
46
|
+
handy patterns for managing page data in Storybook:
|
|
47
|
+
</Text>
|
|
48
|
+
<View>
|
|
49
|
+
<View>
|
|
50
|
+
Use a higher-level connected component. Storybook helps you compose
|
|
51
|
+
such data from the "args" of child component stories
|
|
52
|
+
</View>
|
|
53
|
+
<View>
|
|
54
|
+
Assemble data in the page component from your services. You can mock
|
|
55
|
+
these services out using Storybook.
|
|
56
|
+
</View>
|
|
57
|
+
</View>
|
|
58
|
+
<Text style={styles.p}>
|
|
59
|
+
Get a guided tutorial on component-driven development at{' '}
|
|
60
|
+
<Text
|
|
61
|
+
style={styles.a}
|
|
62
|
+
role='link'
|
|
63
|
+
onPress={() => {
|
|
64
|
+
Linking.openURL('https://storybook.js.org/tutorials/');
|
|
65
|
+
}}
|
|
66
|
+
>
|
|
67
|
+
Storybook tutorials
|
|
68
|
+
</Text>
|
|
69
|
+
. Read more in the{' '}
|
|
70
|
+
<Text
|
|
71
|
+
style={styles.a}
|
|
72
|
+
role='link'
|
|
73
|
+
onPress={() => {
|
|
74
|
+
Linking.openURL('https://storybook.js.org/docs');
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
docs
|
|
78
|
+
</Text>
|
|
79
|
+
.
|
|
80
|
+
</Text>
|
|
81
|
+
<View style={styles.tipWrapper}>
|
|
82
|
+
<View style={styles.tip}>
|
|
83
|
+
<Text style={styles.tipText}>Tip </Text>
|
|
84
|
+
</View>
|
|
85
|
+
<Text>Adjust the width of the canvas with the </Text>
|
|
86
|
+
<Text>Viewports addon in the toolbar</Text>
|
|
87
|
+
</View>
|
|
88
|
+
</View>
|
|
89
|
+
</View>
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const styles = StyleSheet.create({
|
|
93
|
+
section: {
|
|
94
|
+
fontFamily: "'Nunito Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
|
95
|
+
fontSize: 14,
|
|
96
|
+
lineHeight: 24,
|
|
97
|
+
paddingVertical: 48,
|
|
98
|
+
paddingHorizontal: 20,
|
|
99
|
+
marginHorizontal: 'auto',
|
|
100
|
+
maxWidth: 600,
|
|
101
|
+
color: '#333',
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
h2: {
|
|
105
|
+
fontWeight: '900',
|
|
106
|
+
fontSize: 32,
|
|
107
|
+
lineHeight: 1,
|
|
108
|
+
marginBottom: 4,
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
p: {
|
|
112
|
+
marginVertical: 16,
|
|
113
|
+
marginHorizontal: 0,
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
a: {
|
|
117
|
+
color: '#1ea7fd',
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
ul: {
|
|
121
|
+
paddingLeft: 30,
|
|
122
|
+
marginVertical: 16,
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
li: {
|
|
126
|
+
marginBottom: 8,
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
tip: {
|
|
130
|
+
alignSelf: 'flex-start',
|
|
131
|
+
borderRadius: 16,
|
|
132
|
+
backgroundColor: '#e7fdd8',
|
|
133
|
+
paddingVertical: 4,
|
|
134
|
+
paddingHorizontal: 12,
|
|
135
|
+
marginRight: 10,
|
|
136
|
+
marginBottom: 4,
|
|
137
|
+
},
|
|
138
|
+
tipText: {
|
|
139
|
+
fontSize: 11,
|
|
140
|
+
lineHeight: 12,
|
|
141
|
+
fontWeight: '700',
|
|
142
|
+
color: '#66bf3c',
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
tipWrapper: {
|
|
146
|
+
fontSize: 13,
|
|
147
|
+
lineHeight: 20,
|
|
148
|
+
marginTop: 40,
|
|
149
|
+
marginBottom: 40,
|
|
150
|
+
flexDirection: 'row',
|
|
151
|
+
flexWrap: 'wrap',
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
tipWrapperSvg: {
|
|
155
|
+
height: 12,
|
|
156
|
+
width: 12,
|
|
157
|
+
marginRight: 4,
|
|
158
|
+
marginTop: 3,
|
|
159
|
+
},
|
|
160
|
+
});
|