diff --git a/.vscode/settings.json b/.vscode/settings.json index 8bae85e5ee..5981065781 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,6 +8,7 @@ "*.snap": "javascriptreact" }, "eslint.enable": false, + "flow.enabled": false, "files.trimTrailingWhitespace": true, "editor.renderWhitespace": "boundary", "editor.rulers": [120], diff --git a/Example/Emission/index.storybooks.js b/Example/Emission/index.storybooks.js index e09f9471e9..3b7cac71c0 100644 --- a/Example/Emission/index.storybooks.js +++ b/Example/Emission/index.storybooks.js @@ -3,7 +3,7 @@ import { getStorybookUI, configure } from '@kadira/react-native-storybook'; // import your stories configure(() => { - require("../../src/storiesRoot") + require("../../src/storiesRegistry") }, module); const StorybookUI = getStorybookUI({port: 9001, host: 'localhost'}); diff --git a/src/data/colors.ts b/src/data/colors.ts index a30d1ea94d..97b1883600 100644 --- a/src/data/colors.ts +++ b/src/data/colors.ts @@ -1,3 +1,6 @@ +// In TypeScript 2.4 this can turn into an Enum +// https://github.com/Microsoft/TypeScript/pull/15486 + export default { "gray-light": "#f8f8f8", "gray-regular": "#e5e5e5", diff --git a/src/data/fonts.ts b/src/data/fonts.ts new file mode 100644 index 0000000000..a2b0c4cecf --- /dev/null +++ b/src/data/fonts.ts @@ -0,0 +1,8 @@ +// In TypeScript 2.4 this can turn into an Enum +// https://github.com/Microsoft/TypeScript/pull/15486 + +export default { + "garamond-regular": "AGaramondPro-Regular", + "garamond-italic": "AGaramondPro-Italic", + "avant-garde-regular": "Avant Garde Gothic ITCW01Dm", +} diff --git a/src/lib/components/buttons/__stories__/buttons.story.tsx b/src/lib/components/buttons/__stories__/buttons.story.tsx index 4b49f63536..421fd769ab 100644 --- a/src/lib/components/buttons/__stories__/buttons.story.tsx +++ b/src/lib/components/buttons/__stories__/buttons.story.tsx @@ -12,7 +12,7 @@ import NavigationButton from "../navigation_button" const smallButton = { height: 26, width: 320, marginBottom: 20 } const largeButton = { height: 26, width: 320, marginBottom: 20 } -storiesOf("Buttons") +storiesOf("🎨 Buttons") .addDecorator((story) => ( {story()} )) diff --git a/src/lib/components/consignments/__stories__/consignments.story.tsx b/src/lib/components/consignments/__stories__/consignments.story.tsx new file mode 100644 index 0000000000..2de2d6251f --- /dev/null +++ b/src/lib/components/consignments/__stories__/consignments.story.tsx @@ -0,0 +1,17 @@ +import { storiesOf } from "@kadira/react-native-storybook" +import * as React from "react" +import { RootContainer } from "react-relay" + +import Info from "../setup/info" +import Welcome from "../setup/welcome" + +const nav = {} as any +const route = {} as any + +storiesOf("Consignments") + .add("Welcome Page", () => { + return + }) + .add("Info Page", () => { + return + }) diff --git a/src/lib/components/consignments/__stories__/typography.story.tsx b/src/lib/components/consignments/__stories__/typography.story.tsx new file mode 100644 index 0000000000..618ad0f608 --- /dev/null +++ b/src/lib/components/consignments/__stories__/typography.story.tsx @@ -0,0 +1,24 @@ +import { storiesOf } from "@kadira/react-native-storybook" +import * as React from "react" +import { View } from "react-native" + +import Consignment from "../" +import * as T from "../typography" + +const Wrapper = (p) => {p.children} + +storiesOf("Consignments - Type") + + .add("Type Reference", () => + + Large Headline + Small Headline + Subtitle + , + ) + + .add("blank", () => + + Subtitle + , + ) diff --git a/src/lib/components/consignments/typography/index.tsx b/src/lib/components/consignments/typography/index.tsx new file mode 100644 index 0000000000..79cdb92ed9 --- /dev/null +++ b/src/lib/components/consignments/typography/index.tsx @@ -0,0 +1,71 @@ +import * as React from "react" +import { StyleSheet, Text, TextProperties, TextStyle } from "react-native" + +import colors from "../../../../data/colors" +import fonts from "../../../../data/fonts" + +const LargeHeadline = (props: TextProperties) => { + const children: string = (props as any).children + const style = [styles.largeDefault, props.style || {}, styles.largeRequired] + return {children} +} + +const SmallHeadline = (props: TextProperties) => { + const children: string = (props as any).children + const style = [styles.smallDefault, props.style || {}, styles.smallRequired] + return {children} +} + +const Subtitle = (props: TextProperties) => { + const children: string = (props as any).children + const style = [styles.subtitleDefault, props.style || {}, styles.subtitleRequired] + return {children} +} + +export { + LargeHeadline, + SmallHeadline, + Subtitle +} + +interface Styles { + largeRequired: TextStyle + largeDefault: TextStyle + smallRequired: TextStyle + smallDefault: TextStyle + subtitleRequired: TextStyle + subtitleDefault: TextStyle +} + +const styles = StyleSheet.create({ + largeDefault: { + fontSize: 30, + color: "white", + textAlign: "center", + }, + + largeRequired: { + fontFamily: fonts["garamond-regular"], + }, + + smallDefault: { + fontSize: 30, + color: "white", + textAlign: "center", + }, + + smallRequired: { + fontFamily: fonts["garamond-regular"], + }, + + subtitleDefault: { + fontSize: 20, + color: colors["gray-medium"], + paddingLeft: 25, + paddingRight: 25, + }, + + subtitleRequired: { + fontFamily: fonts["garamond-italic"], + }, +}) diff --git a/src/lib/components/text/__stories__/typography.story.tsx b/src/lib/components/text/__stories__/typography.story.tsx new file mode 100644 index 0000000000..4d0f2d97fd --- /dev/null +++ b/src/lib/components/text/__stories__/typography.story.tsx @@ -0,0 +1,14 @@ +import { storiesOf } from "@kadira/react-native-storybook" +import * as React from "react" +import { RootContainer } from "react-relay" + +import Headline from "../headline" +import Serif from "../serif" + +storiesOf("🎨 Typography") + .add("App Headline", () => { + return This is a balnk headline + }) + .add("App Serif Text", () => { + return This is a blank serif + }) diff --git a/src/storiesRegistry.js b/src/storiesRegistry.js new file mode 100644 index 0000000000..fa62004672 --- /dev/null +++ b/src/storiesRegistry.js @@ -0,0 +1,8 @@ + +import "./lib/components/text/__stories__/typography.story" +import "./lib/components/buttons/__stories__/buttons.story" + +import "./lib/containers/__stories__" +import "./lib/components/artist/__stories__" +import "./lib/components/consignments/__stories__/consignments.story" +import "./lib/components/consignments/__stories__/typography.story" diff --git a/src/storiesRoot.js b/src/storiesRoot.js deleted file mode 100644 index f4721d45cb..0000000000 --- a/src/storiesRoot.js +++ /dev/null @@ -1,3 +0,0 @@ -import "./lib/containers/__stories__" -import "./lib/components/artist/__stories__" -import "./lib/components/buttons/__stories__/buttons.story"