Skip to content

Commit

Permalink
feat/v7 store7 (#509)
Browse files Browse the repository at this point in the history
* start v7 store

* generating the index

* stories object with root

* refactor: extract out the intialisation code

* enable all stories

* generate new requires file

* working autotitle

* note

* run generate from metro

* refactor: use the same object for entries and global stories

* fix: doctools
  • Loading branch information
dannyhw authored Oct 15, 2023
1 parent 7e6db94 commit e3c9288
Show file tree
Hide file tree
Showing 74 changed files with 2,343 additions and 1,400 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ module.exports = {
rules: {
'react-native/no-inline-styles': 'off',
'react/react-in-jsx-scope': 'off',
curly: ['error', 'multi-line'],
},
};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ htpasswd
storybook-out
/addons/docs/common/config-*
built-storybooks
examples/expo-example/.storybook/storybook.requires.js
.yarn/*
!.yarn/patches
!.yarn/plugins
Expand Down
10 changes: 0 additions & 10 deletions examples/expo-example/.storybook/doctools.ts

This file was deleted.

285 changes: 285 additions & 0 deletions examples/expo-example/.storybook/index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
{
"v": 4,
"entries": {
"actionbutton--basic": {
"type": "story",
"id": "actionbutton--basic",
"name": "Basic",
"title": "ActionButton",
"importPath": "./components/ActionExample/Actions.stories.tsx",
"tags": ["story"]
},
"actionbutton--another-action": {
"type": "story",
"id": "actionbutton--another-action",
"name": "Another Action",
"title": "ActionButton",
"importPath": "./components/ActionExample/Actions.stories.tsx",
"tags": ["story"]
},
// "backgroundexample-background-csf--basic": {
// "type": "story",
// "id": "backgroundexample-background-csf--basic",
// "name": "Basic",
// "title": "BackgroundExample/Background CSF",
// "importPath": "./components/BackgroundExample/BackgroundCsf.stories.tsx",
// "tags": ["story"]
// },
"controlexamples-array-control--basic": {
"type": "story",
"id": "controlexamples-array-control--basic",
"name": "Basic",
"title": "ControlExamples/Array control",
"importPath": "./components/ControlExamples/Array/Array.stories.tsx",
"tags": ["story"]
}
// "controlexamples-boolean-control--basic": {
// "type": "story",
// "id": "controlexamples-boolean-control--basic",
// "name": "Basic",
// "title": "ControlExamples/Boolean Control",
// "importPath": "./components/ControlExamples/Boolean/Boolean.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-color-control--color-example": {
// "type": "story",
// "id": "controlexamples-color-control--color-example",
// "name": "Color Example",
// "title": "ControlExamples/Color control",
// "importPath": "./components/ControlExamples/Color/Color.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-control-example--example": {
// "type": "story",
// "id": "controlexamples-control-example--example",
// "name": "Example",
// "title": "ControlExamples/Control Example",
// "importPath": "./components/ControlExamples/ControlExample/ControlExample.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-date--basic": {
// "type": "story",
// "id": "controlexamples-date--basic",
// "name": "Basic",
// "title": "ControlExamples/Date",
// "importPath": "./components/ControlExamples/Date/Date.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-number--basic": {
// "type": "story",
// "id": "controlexamples-number--basic",
// "name": "Basic",
// "title": "ControlExamples/Number",
// "importPath": "./components/ControlExamples/Number/Number.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-number--range": {
// "type": "story",
// "id": "controlexamples-number--range",
// "name": "Range",
// "title": "ControlExamples/Number",
// "importPath": "./components/ControlExamples/Number/Number.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-object-control--basic": {
// "type": "story",
// "id": "controlexamples-object-control--basic",
// "name": "Basic",
// "title": "ControlExamples/Object control",
// "importPath": "./components/ControlExamples/Object/Object.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-radio-control--basic": {
// "type": "story",
// "id": "controlexamples-radio-control--basic",
// "name": "Basic",
// "title": "ControlExamples/Radio control",
// "importPath": "./components/ControlExamples/Radio/Radio.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-selectwithnumber--basic": {
// "type": "story",
// "id": "controlexamples-selectwithnumber--basic",
// "name": "Basic",
// "title": "ControlExamples/SelectWithNumber",
// "importPath": "./components/ControlExamples/Reproductions/SelectWithNumber.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-select-control--basic": {
// "type": "story",
// "id": "controlexamples-select-control--basic",
// "name": "Basic",
// "title": "ControlExamples/Select control",
// "importPath": "./components/ControlExamples/Select/Select.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-select-control--with-labels": {
// "type": "story",
// "id": "controlexamples-select-control--with-labels",
// "name": "With Labels",
// "title": "ControlExamples/Select control",
// "importPath": "./components/ControlExamples/Select/Select.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-select-control--with-mapping": {
// "type": "story",
// "id": "controlexamples-select-control--with-mapping",
// "name": "With Mapping",
// "title": "ControlExamples/Select control",
// "importPath": "./components/ControlExamples/Select/Select.stories.tsx",
// "tags": ["story"]
// },
// "controlexamples-text-control--basic": {
// "type": "story",
// "id": "controlexamples-text-control--basic",
// "name": "Basic",
// "title": "ControlExamples/Text control",
// "importPath": "./components/ControlExamples/Text/Text.stories.tsx",
// "tags": ["story"]
// },
// "textinput--basic": {
// "type": "story",
// "id": "textinput--basic",
// "name": "Basic",
// "title": "TextInput",
// "importPath": "./components/InputExample/TextInput.stories.tsx",
// "tags": ["play-fn", "story"]
// },
// "nestingexample-message--message-first": {
// "type": "story",
// "id": "nestingexample-message--message-first",
// "name": "Message First",
// "title": "NestingExample/Message",
// "importPath": "./components/NestingExample/ChatMessage.stories.tsx",
// "tags": ["story"]
// },
// "nestingexample-message--message-second": {
// "type": "story",
// "id": "nestingexample-message--message-second",
// "name": "Message Second",
// "title": "NestingExample/Message",
// "importPath": "./components/NestingExample/ChatMessage.stories.tsx",
// "tags": ["story"]
// },
// "nestingexample-message-bubble--first": {
// "type": "story",
// "id": "nestingexample-message-bubble--first",
// "name": "First",
// "title": "NestingExample/Message/bubble",
// "importPath": "./components/NestingExample/ChatMessageBubble.stories.tsx",
// "tags": ["story"]
// },
// "nestingexample-message-bubble--second": {
// "type": "story",
// "id": "nestingexample-message-bubble--second",
// "name": "Second",
// "title": "NestingExample/Message/bubble",
// "importPath": "./components/NestingExample/ChatMessageBubble.stories.tsx",
// "tags": ["story"]
// },
// "nestingexample-message-bubble-a-very-long-name-for-a-title-that-just-keeps-going-and-going--first": {
// "type": "story",
// "id": "nestingexample-message-bubble-a-very-long-name-for-a-title-that-just-keeps-going-and-going--first",
// "name": "First",
// "title": "NestingExample/Message/bubble/a very long name for a title that just keeps going and going",
// "importPath": "./components/NestingExample/ChatMessageBubbleAgain.stories.tsx",
// "tags": ["story"]
// },
// "nestingexample-message-bubble-a-very-long-name-for-a-title-that-just-keeps-going-and-going--second": {
// "type": "story",
// "id": "nestingexample-message-bubble-a-very-long-name-for-a-title-that-just-keeps-going-and-going--second",
// "name": "Second",
// "title": "NestingExample/Message/bubble/a very long name for a title that just keeps going and going",
// "importPath": "./components/NestingExample/ChatMessageBubbleAgain.stories.tsx",
// "tags": ["story"]
// },
// "nestingexample-messageinput--basic": {
// "type": "story",
// "id": "nestingexample-messageinput--basic",
// "name": "Basic",
// "title": "NestingExample/MessageInput",
// "importPath": "./components/NestingExample/ChatMessageMessageInput.stories.tsx",
// "tags": ["story"]
// },
// "nestingexample-message-reactions--message-one": {
// "type": "story",
// "id": "nestingexample-message-reactions--message-one",
// "name": "Message One",
// "title": "NestingExample/Message/Reactions",
// "importPath": "./components/NestingExample/ChatMessageReactions.stories.tsx",
// "tags": ["story"]
// },
// "nestingexample-message-reactions--message-two": {
// "type": "story",
// "id": "nestingexample-message-reactions--message-two",
// "name": "Message Two",
// "title": "NestingExample/Message/Reactions",
// "importPath": "./components/NestingExample/ChatMessageReactions.stories.tsx",
// "tags": ["story"]
// },
// "storylistview--basic": {
// "type": "story",
// "id": "storylistview--basic",
// "name": "Basic",
// "title": "StoryListView",
// "importPath": "./components/NestingExample/StoryList.stories.tsx",
// "tags": ["story"]
// },
// "notes-example--notes-example": {
// "type": "story",
// "id": "notes-example--notes-example",
// "name": "Notes Example",
// "title": "Notes example",
// "importPath": "./components/NotesExample/NotesExample.stories.tsx",
// "tags": ["story"]
// },
// "safeareaexamples-safearea-inside--basic": {
// "type": "story",
// "id": "safeareaexamples-safearea-inside--basic",
// "name": "Basic",
// "title": "SafeAreaExamples/SafeArea Inside",
// "importPath": "./components/SafeAreaExample/SafeAreaInside.stories.tsx",
// "tags": ["story"]
// },
// "safeareaexamples-safearea-inside--list-basic": {
// "type": "story",
// "id": "safeareaexamples-safearea-inside--list-basic",
// "name": "List Basic",
// "title": "SafeAreaExamples/SafeArea Inside",
// "importPath": "./components/SafeAreaExample/SafeAreaInside.stories.tsx",
// "tags": ["story"]
// },
// "safeareaexamples-safearea-outside--basic": {
// "type": "story",
// "id": "safeareaexamples-safearea-outside--basic",
// "name": "Basic",
// "title": "SafeAreaExamples/SafeArea Outside",
// "importPath": "./components/SafeAreaExample/SafeAreaOutside.stories.tsx",
// "tags": ["story"]
// },
// "safeareaexamples-safearea-outside--list-basic": {
// "type": "story",
// "id": "safeareaexamples-safearea-outside--list-basic",
// "name": "List Basic",
// "title": "SafeAreaExamples/SafeArea Outside",
// "importPath": "./components/SafeAreaExample/SafeAreaOutside.stories.tsx",
// "tags": ["story"]
// },
// "safeareaexamples-usable-area--safe-area": {
// "type": "story",
// "id": "safeareaexamples-usable-area--safe-area",
// "name": "Safe Area",
// "title": "SafeAreaExamples/Usable Area",
// "importPath": "./components/SafeAreaExample/UsableArea.stories.tsx",
// "tags": ["story"]
// },
// "safeareaexamples-usable-area--no-safe-area": {
// "type": "story",
// "id": "safeareaexamples-usable-area--no-safe-area",
// "name": "No Safe Area",
// "title": "SafeAreaExamples/Usable Area",
// "importPath": "./components/SafeAreaExample/UsableArea.stories.tsx",
// "tags": ["story"]
// }
}
}
7 changes: 3 additions & 4 deletions examples/expo-example/.storybook/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';
import { getStorybookUI } from '@storybook/react-native';
// import { getStorybookUI } from '@storybook/react-native';
// import { SafeAreaView } from 'react-native';
import './doctools';
import './storybook.requires';
import { view } from './storybook.requires';

const StorybookUIRoot = getStorybookUI({
const StorybookUIRoot = view.getStorybookUI({
// initialSelection: { kind: 'TextInput', name: 'Basic' },
shouldPersistSelection: true,
// isUIHidden: true,
Expand Down
35 changes: 0 additions & 35 deletions examples/expo-example/.storybook/preview.js

This file was deleted.

37 changes: 37 additions & 0 deletions examples/expo-example/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from 'react';
import { View, StyleSheet, Appearance } from 'react-native';
import { withBackgrounds } from '@storybook/addon-ondevice-backgrounds';
import { Preview } from '@storybook/react';

const styles = StyleSheet.create({
container: { padding: 8, flex: 1 },
});

export default {
decorators: [
(Story) => (
<View style={styles.container}>
<Story />
</View>
),
withBackgrounds,
],
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
my_param: 'anything',
backgrounds: {
default: Appearance.getColorScheme() === 'dark' ? 'dark' : 'plain',
values: [
{ name: 'plain', value: 'white' },
{ name: 'dark', value: '#333' },
{ name: 'app', value: '#eeeeee' },
],
},
},
} satisfies Preview;
Loading

0 comments on commit e3c9288

Please sign in to comment.