diff --git a/.github/workflows/android_build.yml b/.github/workflows/android_build.yml index 4a0554ec..7dd94d0e 100644 --- a/.github/workflows/android_build.yml +++ b/.github/workflows/android_build.yml @@ -19,6 +19,7 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.ref }} + lfs: true - name: Set up Node.js if: ${{ !inputs.skip_build }} @@ -39,7 +40,9 @@ jobs: - name: Build dependencies if: ${{ !inputs.skip_build }} - run: yarn build + run: yarn switch-env:dev + env: + PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} - name: Setup EAS if: ${{ !inputs.skip_build }} diff --git a/.github/workflows/ios_build.yml b/.github/workflows/ios_build.yml index ac3a5708..778d9698 100644 --- a/.github/workflows/ios_build.yml +++ b/.github/workflows/ios_build.yml @@ -19,6 +19,7 @@ jobs: - uses: actions/checkout@v2 with: ref: ${{ github.ref }} + lfs: true - name: Set up Node.js if: ${{ !inputs.skip_build }} @@ -48,7 +49,9 @@ jobs: - name: Build dependencies if: ${{ !inputs.skip_build }} - run: yarn build + run: yarn switch-env:dev + env: + PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} - name: Setup EAS if: ${{ !inputs.skip_build }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 11d52fd1..e419b060 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -40,7 +40,9 @@ jobs: run: npx lerna version $NEW_VERSION_NUMBER --yes --no-git-tag-version --no-push - name: Build packages - run: yarn build + run: yarn switch-env:dev + env: + PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} - name: Commit and push updated files uses: EndBug/add-and-commit@v7 diff --git a/.github/workflows/run_sherlo_async.yml b/.github/workflows/run_sherlo_async.yml index f5f5e978..b7c9ff84 100644 --- a/.github/workflows/run_sherlo_async.yml +++ b/.github/workflows/run_sherlo_async.yml @@ -43,13 +43,16 @@ jobs: run: yarn - name: Build dependencies - run: yarn build + run: yarn switch-env:dev + env: + PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} - name: Run Sherlo Action in async mode id: sherlo_action # This ID is used to reference the output uses: ./. with: projectRoot: examples/expo-example + config: ../../configs/async.storybook.json async: true env: SHERLO_TOKEN: ${{ secrets.SHERLO_TOKEN_ASYNC }} @@ -82,7 +85,9 @@ jobs: run: yarn - name: Build dependencies - run: yarn build + run: yarn switch-env:dev + env: + PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} - name: Download Android Artifact uses: actions/download-artifact@v2 @@ -94,6 +99,7 @@ jobs: uses: ./. with: projectRoot: examples/expo-example + config: ../../configs/async.storybook.json android: builds/preview/android.apk asyncBuildIndex: ${{ needs.run_sherlo_async.outputs.buildIndex }} env: @@ -127,7 +133,9 @@ jobs: run: yarn - name: Build dependencies - run: yarn build + run: yarn switch-env:dev + env: + PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} - name: Download iOS Artifact uses: actions/download-artifact@v2 @@ -139,6 +147,7 @@ jobs: uses: ./. with: projectRoot: examples/expo-example + config: ../../configs/async.storybook.json ios: builds/preview/ios.tar.gz asyncBuildIndex: ${{ needs.run_sherlo_async.outputs.buildIndex }} env: diff --git a/.github/workflows/run_sherlo_eas_hooks.yml b/.github/workflows/run_sherlo_eas_hooks.yml index 13d6ae02..67b582f7 100644 --- a/.github/workflows/run_sherlo_eas_hooks.yml +++ b/.github/workflows/run_sherlo_eas_hooks.yml @@ -2,8 +2,8 @@ name: Run Sherlo with EAS hooks on: pull_request: - branches: [ dev ] - types: [ labeled ] + branches: [dev] + types: [labeled] workflow_call: workflow_dispatch: @@ -21,7 +21,9 @@ jobs: run: yarn - name: Build dependencies - run: yarn build + run: yarn switch-env:dev + env: + PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} - name: Setup EAS uses: expo/expo-github-action@v8 @@ -35,6 +37,7 @@ jobs: uses: ./. with: projectRoot: examples/expo-example + config: ../../configs/eas.preview.json async: true env: SHERLO_TOKEN: ${{ secrets.SHERLO_TOKEN_EAS }} diff --git a/.github/workflows/run_sherlo_sync.yml b/.github/workflows/run_sherlo_sync.yml index 8464369f..b41b6107 100644 --- a/.github/workflows/run_sherlo_sync.yml +++ b/.github/workflows/run_sherlo_sync.yml @@ -18,6 +18,11 @@ on: required: false default: false type: boolean + test_all_nodes: + description: 'Test all Node versions' + required: false + default: false + type: boolean jobs: ## Android @@ -49,6 +54,9 @@ jobs: name: Run Sherlo in sync mode runs-on: ubuntu-latest needs: [android_preview_build, ios_preview_build] + strategy: + matrix: + node-version: ${{ fromJson(github.event.inputs.test_all_nodes && '["18.18.0"]' || '["22.3.0", "21.7.3", "20.14.0", "19.9.0", "18.20.3", "17.9.1", "16.20.2", "15.14.0", "14.21.3", "13.14.0", "12.22.12", "11.15.0", "10.24.1"]') }} steps: - uses: actions/checkout@v2 with: @@ -57,13 +65,15 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '18.18.0' + node-version: ${{ matrix.node-version }} - name: Install dependencies run: yarn - name: Build dependencies - run: yarn build + run: yarn switch-env:dev + env: + PACKAGE_TOKEN: ${{ secrets.PACKAGE_TOKEN }} - name: Download Android Artifact uses: actions/download-artifact@v2 @@ -77,11 +87,16 @@ jobs: name: ios path: examples/expo-example/builds/preview + - name: Echo Directory Path + run: | + echo "Directory Path: examples/expo-example/builds/preview" + ls -la examples/expo-example/builds/preview + - name: Run Sherlo Action uses: ./. with: ios: examples/expo-example/builds/preview/ios.tar.gz android: examples/expo-example/builds/preview/android.apk - config: examples/expo-example/sherlo.config.json + config: configs/sync.preview.json env: SHERLO_TOKEN: ${{ secrets.SHERLO_TOKEN_SYNC }} diff --git a/configs/async.storybook.json b/configs/async.storybook.json new file mode 100644 index 00000000..464616ed --- /dev/null +++ b/configs/async.storybook.json @@ -0,0 +1,89 @@ +{ + "android": "builds/storybook/android.apk", + "ios": "builds/storybook/ios.tar.gz", + "include": ["components/screens/"], + "devices": [ + { + "id": "pixel.tablet", + "osVersion": "13", + "osLanguage": "fr_FR", + "osTheme": "dark" + }, + { + "id": "ipad.9.gen", + "osVersion": "15" + }, + { + "id": "ipad.9.gen", + "osVersion": "16" + }, + { + "id": "ipad.9.gen", + "osVersion": "17" + }, + { + "id": "ipad.10.gen", + "osVersion": "16" + }, + { + "id": "ipad.10.gen", + "osVersion": "17" + }, + { + "id": "ipad.air.5.gen", + "osVersion": "15" + }, + { + "id": "ipad.air.5.gen", + "osVersion": "16" + }, + { + "id": "ipad.air.5.gen", + "osVersion": "17" + }, + { + "id": "ipad.air.11.m2", + "osVersion": "17" + }, + { + "id": "ipad.air.13.m2", + "osVersion": "17" + }, + { + "id": "ipad.mini.6.gen", + "osVersion": "15" + }, + { + "id": "ipad.mini.6.gen", + "osVersion": "16" + }, + { + "id": "ipad.mini.6.gen", + "osVersion": "17" + }, + { + "id": "ipad.pro.11.4.gen", + "osVersion": "16" + }, + { + "id": "ipad.pro.11.4.gen", + "osVersion": "17" + }, + { + "id": "ipad.pro.11.m4", + "osVersion": "17" + }, + { + "id": "ipad.pro.12.9.6.gen", + "osVersion": "16" + }, + { + "id": "ipad.pro.12.9.6.gen", + "osVersion": "17" + }, + { + "id": "ipad.pro.13.m4", + "osVersion": "17" + } + ] +} diff --git a/configs/demo.preview.json b/configs/demo.preview.json new file mode 100644 index 00000000..32719e04 --- /dev/null +++ b/configs/demo.preview.json @@ -0,0 +1,43 @@ +{ + "android": "builds/preview/android.apk", + "ios": "builds/preview/ios.tar.gz", + "include": ["components/screens/"], + "devices": [ + { + "id": "pixel.4a", + "osVersion": "13", + "osLanguage": "en_US", + "osTheme": "light" + }, + { + "id": "pixel.7.pro", + "osVersion": "13", + "osLanguage": "en_US", + "osTheme": "light" + }, + { + "id": "pixel.tablet", + "osVersion": "13", + "osLanguage": "fr_FR", + "osTheme": "dark" + }, + { + "id": "iphone.13.mini", + "osVersion": "15", + "osLanguage": "en_US", + "osTheme": "light" + }, + { + "id": "iphone.15.pro", + "osVersion": "17", + "osLanguage": "en_US", + "osTheme": "light" + }, + { + "id": "ipad.pro.13.m4", + "osVersion": "17", + "osLanguage": "en_US", + "osTheme": "light" + } + ] +} diff --git a/configs/eas.preview.json b/configs/eas.preview.json new file mode 100644 index 00000000..d7e67908 --- /dev/null +++ b/configs/eas.preview.json @@ -0,0 +1,85 @@ +{ + "android": "builds/preview/android.apk", + "ios": "builds/preview/ios.tar.gz", + "include": ["components/screens/"], + "devices": [ + { + "id": "pixel.6a", + "osVersion": "13", + "osLanguage": "en_US", + "osTheme": "light" + }, + { + "id": "pixel.6", + "osVersion": "13", + "osLanguage": "de_DE", + "osTheme": "light" + }, + { + "id": "pixel.6.pro", + "osVersion": "13", + "osLanguage": "fr_FR", + "osTheme": "dark" + }, + { + "id": "pixel.7", + "osVersion": "13", + "osLanguage": "en_US", + "osTheme": "light" + }, + { + "id": "pixel.7.pro", + "osVersion": "13", + "osLanguage": "de_DE", + "osTheme": "light" + }, + { + "id": "iphone.13.mini", + "osVersion": "15" + }, + { + "id": "iphone.13.mini", + "osVersion": "16" + }, + { + "id": "iphone.13.mini", + "osVersion": "17" + }, + { + "id": "iphone.13.pro.max", + "osVersion": "15" + }, + { + "id": "iphone.13.pro.max", + "osVersion": "16" + }, + { + "id": "iphone.13.pro.max", + "osVersion": "17" + }, + { + "id": "iphone.13.pro", + "osVersion": "15" + }, + { + "id": "iphone.13.pro", + "osVersion": "16" + }, + { + "id": "iphone.13.pro", + "osVersion": "17" + }, + { + "id": "iphone.13", + "osVersion": "15" + }, + { + "id": "iphone.13", + "osVersion": "16" + }, + { + "id": "iphone.13", + "osVersion": "17" + } + ] +} diff --git a/configs/sync.preview.json b/configs/sync.preview.json new file mode 100644 index 00000000..1a674ee3 --- /dev/null +++ b/configs/sync.preview.json @@ -0,0 +1,91 @@ +{ + "android": "builds/preview/android.apk", + "ios": "builds/preview/ios.tar.gz", + "include": ["components/screens/"], + "devices": [ + { + "id": "pixel.4a", + "osVersion": "13", + "osLanguage": "en_US", + "osTheme": "light" + }, + { + "id": "pixel.4", + "osVersion": "13", + "osLanguage": "de_DE", + "osTheme": "light" + }, + { + "id": "pixel.4.xl", + "osVersion": "13", + "osLanguage": "fr_FR", + "osTheme": "dark" + }, + { + "id": "pixel.5", + "osVersion": "13", + "osLanguage": "pl_PL", + "osTheme": "dark" + }, + { + "id": "iphone.14.plus", + "osVersion": "16" + }, + { + "id": "iphone.14.plus", + "osVersion": "17" + }, + { + "id": "iphone.14.pro.max", + "osVersion": "16" + }, + { + "id": "iphone.14.pro.max", + "osVersion": "17" + }, + { + "id": "iphone.14.pro", + "osVersion": "16" + }, + { + "id": "iphone.14.pro", + "osVersion": "17" + }, + { + "id": "iphone.14", + "osVersion": "16" + }, + { + "id": "iphone.14", + "osVersion": "17" + }, + { + "id": "iphone.15.plus", + "osVersion": "17" + }, + { + "id": "iphone.15.pro.max", + "osVersion": "17" + }, + { + "id": "iphone.15.pro", + "osVersion": "17" + }, + { + "id": "iphone.15", + "osVersion": "17" + }, + { + "id": "iphone.se.3.gen", + "osVersion": "15" + }, + { + "id": "iphone.se.3.gen", + "osVersion": "16" + }, + { + "id": "iphone.se.3.gen", + "osVersion": "17" + } + ] +} diff --git a/examples/expo-example/App.tsx b/examples/expo-example/App.tsx index 443eb349..cd68df74 100644 --- a/examples/expo-example/App.tsx +++ b/examples/expo-example/App.tsx @@ -59,6 +59,8 @@ export default function App() { if (process.env.EXPO_PUBLIC_STORYBOOK_ONLY === 'true') { const Storybook = require('./.storybook').default; EntryPoint = Storybook; + } else if (process.env.PROD_BUILD === 'true') { + EntryPoint = App; } else { const Storybook = require('./.storybook').default; EntryPoint = withStorybook(App, Storybook); diff --git a/examples/expo-example/builds/preview/android.apk b/examples/expo-example/builds/preview/android.apk new file mode 100644 index 00000000..b03e2a4d --- /dev/null +++ b/examples/expo-example/builds/preview/android.apk @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d5f440bd5667326a2d4bd08442ea90815ab64b64a51bdf696c53a994cc7ecda +size 68209006 diff --git a/examples/expo-example/builds/preview/ios.tar.gz b/examples/expo-example/builds/preview/ios.tar.gz new file mode 100644 index 00000000..8694faa7 --- /dev/null +++ b/examples/expo-example/builds/preview/ios.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c699be100c150bf365ca2f0895b739f7465a8ac77dd8466acc1db4a680d0cce4 +size 13461530 diff --git a/examples/expo-example/builds/storybook/android.apk b/examples/expo-example/builds/storybook/android.apk new file mode 100644 index 00000000..0f023e1a --- /dev/null +++ b/examples/expo-example/builds/storybook/android.apk @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c06e089e1fbda3036c860221477631dc0b23ac9a9266174f12b159774e92c8ea +size 68197489 diff --git a/examples/expo-example/builds/storybook/ios.tar.gz b/examples/expo-example/builds/storybook/ios.tar.gz new file mode 100644 index 00000000..33dbc82e --- /dev/null +++ b/examples/expo-example/builds/storybook/ios.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:35d0c29a7e18e55c37bec47c3bbc6ffbde2f353b8bf6c37f2f52b6687a73ea5f +size 13446222 diff --git a/examples/expo-example/package.json b/examples/expo-example/package.json index b815d34f..46c4f7d0 100644 --- a/examples/expo-example/package.json +++ b/examples/expo-example/package.json @@ -18,7 +18,10 @@ "ios:start:dev": "tar -xzvf builds/development/ios.tar.gz -C builds/ && xcrun simctl install booted builds/sherloexpoexample.app && expo start --ios --dev-client", "ios:start:go": "expo start --ios --go", "sherlo": "sherlo", - "sherlo:storybookOnly": "sherlo --config sherlo.storybookOnly.json", + "sherlo:async": "sherlo --config ../../configs/demo.storybook.json", + "sherlo:demo": "sherlo --config ../../configs/demo.preview.json", + "sherlo:eas": "sherlo --config ../../configs/eas.preview.json", + "sherlo:sync": "sherlo --config ../../configs/sync.preview.json", "storybook:web": "storybook dev -p 6006 -c .storybook-web", "storybook:native:generate": "sb-rn-get-stories --config-path .storybook" }, diff --git a/examples/expo-example/sherlo.config.json b/examples/expo-example/sherlo.config.json index fd9c7d3c..d59c9c76 100644 --- a/examples/expo-example/sherlo.config.json +++ b/examples/expo-example/sherlo.config.json @@ -1,30 +1,44 @@ { - "apps": { - "android": { - "path": "builds/preview/android.apk", - "packageName": "com.sherlo.example" - }, - "ios": { - "path": "./builds/preview/ios.tar.gz", - "bundleIdentifier": "com.sherlo.example" - } - }, + "token": "twQUoTOqxJa5zSNQQz4z1ZrCGJAPlnEnucyN_GCY6", + "android": "builds/preview/android.apk", + "ios": "builds/preview/ios.tar.gz", + "include": ["components/screens/"], "devices": [ { - "id": "iphone.15.pro", - "osVersion": "17" + "id": "pixel.4a", + "osVersion": "13", + "osLanguage": "en_US", + "osTheme": "light" }, { - "id": "iphone.se.3", - "osVersion": "16" + "id": "pixel.7.pro", + "osVersion": "13", + "osLanguage": "en_US", + "osTheme": "light" }, { - "id": "pixel.7", - "osVersion": "13" + "id": "pixel.tablet", + "osVersion": "13", + "osLanguage": "fr_FR", + "osTheme": "dark" }, { - "id": "pixel.7.pro", - "osVersion": "13" + "id": "iphone.13.mini", + "osVersion": "15", + "osLanguage": "en_US", + "osTheme": "light" + }, + { + "id": "iphone.15.pro", + "osVersion": "17", + "osLanguage": "en_US", + "osTheme": "light" + }, + { + "id": "ipad.pro.13.m4", + "osVersion": "17", + "osLanguage": "en_US", + "osTheme": "light" } ] } diff --git a/examples/expo-example/sherlo.storybookOnly.json b/examples/expo-example/sherlo.storybookOnly.json deleted file mode 100644 index 47b93f7e..00000000 --- a/examples/expo-example/sherlo.storybookOnly.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "apps": { - "android": { - "path": "builds/storybook/android.apk", - "packageName": "com.sherlo.example" - }, - "ios": { - "path": "./builds/storybook/ios.tar.gz", - "bundleIdentifier": "com.sherlo.example" - } - }, - "devices": [ - { - "id": "iphone.15.pro", - "osVersion": "17" - }, - { - "id": "iphone.se.3", - "osVersion": "16" - }, - { - "id": "pixel.7", - "osVersion": "13" - }, - { - "id": "pixel.7.pro", - "osVersion": "13" - } - ] -} diff --git a/examples/expo-example/src/components/base/Icon/Icon.tsx b/examples/expo-example/src/components/base/Icon/Icon.tsx index 55358ff9..91b387fc 100644 --- a/examples/expo-example/src/components/base/Icon/Icon.tsx +++ b/examples/expo-example/src/components/base/Icon/Icon.tsx @@ -9,6 +9,7 @@ import PlusBoxIcon from './Icons/PlusBoxIcon'; import SplotchIcon from './Icons/SplotchIcon'; import PlusIcon from './Icons/PlusIcon'; import MinusIcon from './Icons/MinusIcon'; +import { dimensions } from 'theme/dimensions'; export interface IconProps { name: @@ -31,13 +32,13 @@ const Icon = ({ name, size, isActive }: IconProps) => { switch (size) { case 'small': - sizePx = 16; + sizePx = dimensions.iconsSizeSmall; break; case 'medium': - sizePx = 22; + sizePx = dimensions.iconsSizeMedium; break; case 'big': - sizePx = 27; + sizePx = dimensions.iconsSizeBig; break; } diff --git a/examples/expo-example/src/components/base/Switch/Switch.tsx b/examples/expo-example/src/components/base/Switch/Switch.tsx index 86207f02..bfafd123 100644 --- a/examples/expo-example/src/components/base/Switch/Switch.tsx +++ b/examples/expo-example/src/components/base/Switch/Switch.tsx @@ -2,6 +2,7 @@ import React, { useState } from 'react'; import { StyleSheet, View } from 'react-native'; import { Switch as SwitchComponent } from 'react-native-switch'; import { colors } from '../../../theme/colors'; +import { dimensions } from 'theme/dimensions'; export interface SwitchProps { state: boolean; @@ -11,10 +12,10 @@ export interface SwitchProps { const Switch = ({ state, setState }: SwitchProps) => { const styles = StyleSheet.create({ container: { - width: 45, - height: 29.7, + width: dimensions.switchWidth, + height: dimensions.switchHeight, borderRadius: 50, - borderWidth: 1.2, + borderWidth: dimensions.switchBorderWidth, borderColor: state ? colors.activeLow : colors.grayLow, }, }); @@ -25,8 +26,8 @@ const Switch = ({ state, setState }: SwitchProps) => { value={state} onValueChange={setState} disabled={false} - circleSize={20.25} - barHeight={27} + circleSize={dimensions.switchCircleSize} + barHeight={dimensions.switchBarHaight} circleBorderWidth={0} backgroundActive={'transparent'} backgroundInactive={'transparent'} diff --git a/examples/expo-example/src/components/base/Text/Text.tsx b/examples/expo-example/src/components/base/Text/Text.tsx index ea1ddfa4..6095250c 100644 --- a/examples/expo-example/src/components/base/Text/Text.tsx +++ b/examples/expo-example/src/components/base/Text/Text.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { Text as TextComponent, StyleSheet } from 'react-native'; import { colors } from '../../../theme/colors'; +import { dimensions } from 'theme/dimensions'; interface TextProps { variant: @@ -55,61 +56,62 @@ export default Text; const styles = StyleSheet.create({ headline: { fontFamily: 'Urbanist_600SemiBold', - fontSize: 20.25, + fontSize: dimensions.fontSize4, letterSpacing: 0, color: colors.textHighlight, }, headlineInactive: { fontFamily: 'Urbanist_600SemiBold', - fontSize: 20.25, + fontSize: dimensions.fontSize4, letterSpacing: 0, color: colors.textSubtle, }, subtitle: { fontFamily: 'Urbanist_500Medium', - fontSize: 16.2, + fontSize: dimensions.fontSize2, letterSpacing: 0, color: colors.textSubtle, }, tutorialHeadline: { fontFamily: 'Urbanist_700Bold', - fontSize: 24.3, + fontSize: dimensions.fontSize6, letterSpacing: 0, color: colors.textHighlight, }, tutorialSubtitle: { fontFamily: 'Urbanist_400Regular', - fontSize: 21.6, + fontSize: dimensions.fontSize5, letterSpacing: 0, color: colors.textHighlight, + textAlign: 'center', }, tutorialButton: { fontFamily: 'Urbanist_700Bold', - fontSize: 17.5, + fontSize: dimensions.fontSize3, letterSpacing: 0, color: colors.textHighlight, }, usernameText: { fontFamily: 'Urbanist_600SemiBold', - fontSize: 24.3, + fontSize: dimensions.fontSize6, letterSpacing: 0, color: colors.textHighlight, }, displayBox: { fontFamily: 'Urbanist_500Medium', - fontSize: 13.5, + fontSize: dimensions.fontSize1, letterSpacing: 0, color: colors.textDisplayBox, }, displayBoxValue: { fontFamily: 'Urbanist_700Bold', - fontSize: 16.2, + fontSize: dimensions.fontSize2, letterSpacing: 0, color: colors.textHighlight, }, time: { fontFamily: 'Urbanist_500Medium', - fontSize: 16.2, + fontSize: dimensions.fontSize2, letterSpacing: 0, color: colors.textHighlight, }, diff --git a/examples/expo-example/src/components/base/TutorialIcon/TutorialIcon.stories.tsx b/examples/expo-example/src/components/base/TutorialIcon/TutorialIcon.stories.tsx new file mode 100644 index 00000000..84ddccd8 --- /dev/null +++ b/examples/expo-example/src/components/base/TutorialIcon/TutorialIcon.stories.tsx @@ -0,0 +1,26 @@ +import type { Meta } from '@storybook/react'; +import TutorialIcon from './TutorialIcon'; +import StoryDecorator from '../../../decorators/StoryDecorator'; + +export default { + component: TutorialIcon, + decorators: [StoryDecorator], +} as Meta; + +type Story = { + args: { + appState: string; + }; +}; + +export const TutorialStage1: Story = { + args: { + appState: 'tutorial1', + }, +}; + +export const TutorialStage2: Story = { + args: { + appState: 'tutorial2', + }, +}; diff --git a/examples/expo-example/src/components/base/TutorialIcon/TutorialIcon.tsx b/examples/expo-example/src/components/base/TutorialIcon/TutorialIcon.tsx new file mode 100644 index 00000000..94cb4eec --- /dev/null +++ b/examples/expo-example/src/components/base/TutorialIcon/TutorialIcon.tsx @@ -0,0 +1,32 @@ +import React from 'react'; +import { View, StyleSheet } from 'react-native'; +import Connect from '../Icon/Icons/Connect'; +import SaveEnergy from '../Icon/Icons/SaveEnergy'; +import { shadows } from '../../../theme/shadows'; + +interface TutorialIconProps { + appState: string; +} + +const TutorialIcon = ({ appState }: TutorialIconProps) => { + return ( + + {appState === 'tutorial1' ? : } + + ); +}; + +export default TutorialIcon; + +const styles = StyleSheet.create({ + iconContainer: { + // flex: 0.6, + alignSelf: 'center', + alignItems: 'center', + justifyContent: 'space-around', + width: 206.525, + height: 206.525, + borderRadius: 67.492, + backgroundColor: '#16171A', + }, +}); diff --git a/examples/expo-example/src/components/base/TutorialIcon/index.ts b/examples/expo-example/src/components/base/TutorialIcon/index.ts new file mode 100644 index 00000000..e69de29b diff --git a/examples/expo-example/src/components/partials/ButtonPlusMinus/ButtonPlusMinus.stories.tsx b/examples/expo-example/src/components/partials/ButtonPlusMinus/ButtonPlusMinus.stories.tsx new file mode 100644 index 00000000..853014c7 --- /dev/null +++ b/examples/expo-example/src/components/partials/ButtonPlusMinus/ButtonPlusMinus.stories.tsx @@ -0,0 +1,16 @@ +import type { Meta } from "@storybook/react"; +import ButtonPlusMinus from "./ButtonPlusMinus"; +import StoryDecorator from "../../../decorators/StoryDecorator"; + +export default { + component: ButtonPlusMinus, + parameters: { + sherlo: { + figmaUrl: + "https://www.figma.com/file/MQKuH5Z7IrlnltVk4ox3oB/Sherlo-Expo-Example?type=design&node-id=1503-29771&mode=design&t=EYCV0O9ZvPUybxCL-4", + }, + }, + decorators: [StoryDecorator], +} as Meta; + +export const Basic = {}; diff --git a/examples/expo-example/src/components/partials/ButtonPlusMinus/ButtonPlusMinus.tsx b/examples/expo-example/src/components/partials/ButtonPlusMinus/ButtonPlusMinus.tsx new file mode 100644 index 00000000..1956e9a6 --- /dev/null +++ b/examples/expo-example/src/components/partials/ButtonPlusMinus/ButtonPlusMinus.tsx @@ -0,0 +1,51 @@ +import React from "react"; + +import { colors } from "../../../theme/colors"; +import { shadows } from "../../../theme/shadows"; + +import { LinearGradient } from "expo-linear-gradient"; +import { StyleSheet, TouchableOpacity, View } from "react-native"; +import Icon from "../../base/Icon/Icon"; + +const ButtonPlusMinus = () => { + return ( + + + + + + + + + + + + + + + ); +}; + +export default ButtonPlusMinus; + +const styles = StyleSheet.create({ + container: { + flexDirection: "row", + justifyContent: "center", + overflow: "hidden", + borderRadius: 67.492, + backgroundColor: colors.buttonPlusMinusBackground, + }, + button: { + flex: 1, + padding: 14, + justifyContent: "center", + alignItems: "center", + backgroundColor: colors.background, + }, +}); diff --git a/examples/expo-example/src/components/partials/ButtonPlusMinus/index.ts b/examples/expo-example/src/components/partials/ButtonPlusMinus/index.ts new file mode 100644 index 00000000..f6e1b419 --- /dev/null +++ b/examples/expo-example/src/components/partials/ButtonPlusMinus/index.ts @@ -0,0 +1,2 @@ +export { default } from "./ButtonPlusMinus"; + diff --git a/examples/expo-example/src/components/partials/CardItem/CardItem.tsx b/examples/expo-example/src/components/partials/CardItem/CardItem.tsx index 72453d1a..7d2a2513 100644 --- a/examples/expo-example/src/components/partials/CardItem/CardItem.tsx +++ b/examples/expo-example/src/components/partials/CardItem/CardItem.tsx @@ -66,9 +66,12 @@ const styles = StyleSheet.create({ bottom: 0, }, image: { - position: 'absolute', - right: 0, - bottom: 0, + // flex: 1, + // position: 'absolute', + // right: 0, + // bottom: 0, + width: '100%', + height: '100%', resizeMode: 'cover', borderRadius: 18.218, }, diff --git a/examples/expo-example/src/components/partials/InfoDisplay/InfoDisplay.stories.tsx b/examples/expo-example/src/components/partials/InfoDisplay/InfoDisplay.stories.tsx new file mode 100644 index 00000000..0517a355 --- /dev/null +++ b/examples/expo-example/src/components/partials/InfoDisplay/InfoDisplay.stories.tsx @@ -0,0 +1,24 @@ +import type { Meta } from '@storybook/react'; +import InfoDisplay from './InfoDisplay'; + +export default { + component: InfoDisplay, +} as Meta; + +type Story = { + args: { + variant: string; + }; +}; + +export const Heating: Story = { + args: { + variant: 'Heating', + }, +}; + +export const AirPurifier: Story = { + args: { + variant: 'Air Purifier', + }, +}; diff --git a/examples/expo-example/src/components/partials/InfoDisplay/InfoDisplay.tsx b/examples/expo-example/src/components/partials/InfoDisplay/InfoDisplay.tsx new file mode 100644 index 00000000..32656843 --- /dev/null +++ b/examples/expo-example/src/components/partials/InfoDisplay/InfoDisplay.tsx @@ -0,0 +1,45 @@ +import React from 'react'; +import InfoDisplayBox from './components/InfoDisplayBox'; +import { View, StyleSheet } from 'react-native'; +import { dimensions } from '../../../theme/dimensions'; +import { breakIntoLines } from '../../../utils/breakIntoLines'; + +interface infoDisplayProps { + variant: 'Heating' | 'Air Purifier'; + airHumidity?: number; + actualTemperature?: number; + pm?: number; + dust?: number; +} + +const InfoDisplay = ({ variant, airHumidity, actualTemperature, pm, dust }: infoDisplayProps) => { + return variant === 'Heating' ? ( + + + + + + ) : ( + + + + + ); +}; + +export default InfoDisplay; + +const styles = StyleSheet.create({ + container: { + // ustawić to na ekranie nie w komponencie + flex: 0.4, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'space-between', + columnGap: dimensions.infoDisplayGap, + }, +}); diff --git a/examples/expo-example/src/components/partials/InfoDisplay/components/InfoDisplayBox.tsx b/examples/expo-example/src/components/partials/InfoDisplay/components/InfoDisplayBox.tsx new file mode 100644 index 00000000..e56c0690 --- /dev/null +++ b/examples/expo-example/src/components/partials/InfoDisplay/components/InfoDisplayBox.tsx @@ -0,0 +1,61 @@ +import React, { useDeferredValue } from "react"; +import { View, StyleSheet } from "react-native"; +import Text from "../../../base/Text/Text"; +import Switch from "../../../base/Switch/Switch"; +import { colors } from "../../../../theme/colors"; +import { dimensions } from "../../../../theme/dimensions"; +import { shadows } from "../../../../theme/shadows"; +// import { breakIntoLines } from "../utils/breakIntoLines" + +type InfoDisplayBoxProps = + | { + name: string; + variant: "info"; + value: string; + } + | { variant: "switch" }; + +const InfoDisplayBox = (props: InfoDisplayBoxProps) => { + return ( + + {props.variant === "switch" ? ( + <> + Auto + + + ) : ( + <> + {props.name} + {props.value} + + )} + + ); +}; + +export default InfoDisplayBox + +const styles = StyleSheet.create({ + container: { + height: "100%", + padding: dimensions.infoDisplayBoxPadding, + backgroundColor: colors.infoDisplayBoxBackground, + + borderRadius: 16.198, + borderWidth: 0.675, + borderColor: colors.infoDisplayBoxBorder, + }, + switch: { + flex: 0.66, + justifyContent: "space-between", + }, + text: { + flex: 1, + }, +}); diff --git a/examples/expo-example/src/components/partials/InfoDisplay/components/index.ts b/examples/expo-example/src/components/partials/InfoDisplay/components/index.ts new file mode 100644 index 00000000..a1382d08 --- /dev/null +++ b/examples/expo-example/src/components/partials/InfoDisplay/components/index.ts @@ -0,0 +1 @@ +export { default } from "./InfoDisplayBox"; diff --git a/examples/expo-example/src/components/partials/InfoDisplay/index.ts b/examples/expo-example/src/components/partials/InfoDisplay/index.ts new file mode 100644 index 00000000..39693b9d --- /dev/null +++ b/examples/expo-example/src/components/partials/InfoDisplay/index.ts @@ -0,0 +1 @@ +export { default } from "./InfoDisplay"; diff --git a/examples/expo-example/src/components/partials/SettingsButton/SettingsButton.stories.tsx b/examples/expo-example/src/components/partials/SettingsButton/SettingsButton.stories.tsx new file mode 100644 index 00000000..a7b548a4 --- /dev/null +++ b/examples/expo-example/src/components/partials/SettingsButton/SettingsButton.stories.tsx @@ -0,0 +1,12 @@ +import type { Meta } from '@storybook/react'; +import SettingsButton from './SettingsButton'; + +export default { + component: SettingsButton, +} as Meta; + +type Story = { + args?: Record; +}; + +export const Basic: Story = {}; diff --git a/examples/expo-example/src/components/partials/SettingsButton/SettingsButton.tsx b/examples/expo-example/src/components/partials/SettingsButton/SettingsButton.tsx new file mode 100644 index 00000000..be320a3a --- /dev/null +++ b/examples/expo-example/src/components/partials/SettingsButton/SettingsButton.tsx @@ -0,0 +1,36 @@ +import React from 'react'; +import { View, StyleSheet } from 'react-native'; +import { dimensions } from '../../../theme/dimensions'; +import { colors } from '../../../theme/colors'; +import { shadows } from '../../../theme/shadows'; +import IconButton from '../../base/IconButton/IconButton'; + +const SettingsButton = () => { + return ( + + + + ); +}; + +export default SettingsButton; + +const styles = StyleSheet.create({ + container: { + flexDirection: 'row', + justifyContent: 'flex-start', + alignItems: 'center', + width: dimensions.settingsButtonWidth, + height: dimensions.settingsButtonHeight, + backgroundColor: colors.settingsButtonBackground, + + borderRadius: 67.492, + borderWidth: 0.675, + borderColor: colors.settingsButtonBorder, + + position: 'absolute', + right: -(dimensions.controllScreenMargin + dimensions.settingsButtonWidth / 4), + + paddingLeft: dimensions.settingsButtonPadding, + }, +}); diff --git a/examples/expo-example/src/components/partials/SettingsButton/index.ts b/examples/expo-example/src/components/partials/SettingsButton/index.ts new file mode 100644 index 00000000..648f66ae --- /dev/null +++ b/examples/expo-example/src/components/partials/SettingsButton/index.ts @@ -0,0 +1 @@ +export { default } from "./SettingsButton"; diff --git a/examples/expo-example/src/components/partials/SettingsTime/SettingsTime.stories.tsx b/examples/expo-example/src/components/partials/SettingsTime/SettingsTime.stories.tsx new file mode 100644 index 00000000..65faa546 --- /dev/null +++ b/examples/expo-example/src/components/partials/SettingsTime/SettingsTime.stories.tsx @@ -0,0 +1,12 @@ +import type { Meta } from '@storybook/react'; +import SettingsTime from './SettingsTime'; + +export default { + component: SettingsTime, +} as Meta; + +type Story = { + args?: Record; +}; + +export const Basic: Story = {}; diff --git a/examples/expo-example/src/components/partials/SettingsTime/SettingsTime.tsx b/examples/expo-example/src/components/partials/SettingsTime/SettingsTime.tsx new file mode 100644 index 00000000..6cb606de --- /dev/null +++ b/examples/expo-example/src/components/partials/SettingsTime/SettingsTime.tsx @@ -0,0 +1,34 @@ +import React from 'react'; +import { View, StyleSheet } from 'react-native'; +import TimeBox from './components/TimeBox'; +import { colors } from '../../../theme/colors'; + +const SettingsTime = () => { + return ( + + + + + + ); +}; + +export default SettingsTime; + +const styles = StyleSheet.create({ + container: { + flexDirection: 'row', + justifyContent: 'center', + + borderRadius: 5.4, + borderWidth: 0.675, + borderColor: colors.settingsTimeBorder, + + overflow: 'hidden', + }, +}); diff --git a/examples/expo-example/src/components/partials/SettingsTime/components/TimeBox.tsx b/examples/expo-example/src/components/partials/SettingsTime/components/TimeBox.tsx new file mode 100644 index 00000000..a2b05155 --- /dev/null +++ b/examples/expo-example/src/components/partials/SettingsTime/components/TimeBox.tsx @@ -0,0 +1,63 @@ +import React, { useState } from "react"; +import { View, StyleSheet } from "react-native"; +import Text from "../../../base/Text/Text"; +import { dimensions } from "../../../../theme/dimensions"; +import IconButton from "../../../base/IconButton/IconButton"; +import DateTimePickerModal from "react-native-modal-datetime-picker"; + +interface TimeBoxProps { + variant: "from" | "to"; +} + + const TimeBox = ({ variant }: TimeBoxProps) => { + const [isDatePickerVisible, setDatePickerVisibility] = useState(false); + const [selectedHour, setSelectedHour] = useState(new Date()); + + const handleConfirm = (date: Date) => { + setSelectedHour(date); + setDatePickerVisibility(false); + }; + + const showDatePicker = () => { + setDatePickerVisibility(true); + }; + + const hideDatePicker = () => { + setDatePickerVisibility(false); + }; + + const formattedTime = selectedHour.toLocaleTimeString([], { + hour: "2-digit", + minute: "2-digit", + }); + + return ( + + {`${ + variant === "from" ? "from" : "To" + }: ${formattedTime}`} + + + + + + ); +}; + +export default TimeBox + +const styles = StyleSheet.create({ + container: { + flex: 1, + flexDirection: "row", + justifyContent: "center", + alignItems: "center", + columnGap: dimensions.timeBoxGap, + padding: dimensions.timeBoxPadding, + }, +}); diff --git a/examples/expo-example/src/components/partials/SettingsTime/components/index.ts b/examples/expo-example/src/components/partials/SettingsTime/components/index.ts new file mode 100644 index 00000000..5febbae7 --- /dev/null +++ b/examples/expo-example/src/components/partials/SettingsTime/components/index.ts @@ -0,0 +1 @@ +export { default } from "./TimeBox"; diff --git a/examples/expo-example/src/components/partials/SettingsTime/index.ts b/examples/expo-example/src/components/partials/SettingsTime/index.ts new file mode 100644 index 00000000..568e991f --- /dev/null +++ b/examples/expo-example/src/components/partials/SettingsTime/index.ts @@ -0,0 +1 @@ +export { default } from "./SettingsTime"; diff --git a/examples/expo-example/src/components/partials/TabComponent/TabComponent.tsx b/examples/expo-example/src/components/partials/TabComponent/TabComponent.tsx index f4a81aa5..4002e01a 100644 --- a/examples/expo-example/src/components/partials/TabComponent/TabComponent.tsx +++ b/examples/expo-example/src/components/partials/TabComponent/TabComponent.tsx @@ -22,7 +22,7 @@ const TabComponent: React.FC = ({ activePage, setActivePage } return ( <> - + ); }; diff --git a/examples/expo-example/src/components/partials/TabComponent/Tabs/Tabs.tsx b/examples/expo-example/src/components/partials/TabComponent/Tabs/Tabs.tsx index 962c2fad..7bf9392e 100644 --- a/examples/expo-example/src/components/partials/TabComponent/Tabs/Tabs.tsx +++ b/examples/expo-example/src/components/partials/TabComponent/Tabs/Tabs.tsx @@ -21,12 +21,8 @@ const Tabs = ({ pagerRef, handlePageChange, initialPage }: TabsProps) => { onPageSelected={handlePageChange} pageMargin={40} > - - - - - - + + ); }; diff --git a/examples/expo-example/src/components/partials/TabDevice/TabDevice.stories.tsx b/examples/expo-example/src/components/partials/TabDevice/TabDevice.stories.tsx new file mode 100644 index 00000000..9a10f9d2 --- /dev/null +++ b/examples/expo-example/src/components/partials/TabDevice/TabDevice.stories.tsx @@ -0,0 +1,13 @@ +import type { Meta } from '@storybook/react'; +import { TabDevice } from './TabDevice'; + +export default { + component: TabDevice, + args: [], +} as Meta; + +export const Basic = { + args: { + deviceName: 'Heating', + }, +}; diff --git a/examples/expo-example/src/components/partials/TabDevice/TabDevice.tsx b/examples/expo-example/src/components/partials/TabDevice/TabDevice.tsx new file mode 100644 index 00000000..cff928eb --- /dev/null +++ b/examples/expo-example/src/components/partials/TabDevice/TabDevice.tsx @@ -0,0 +1,47 @@ +import React, { useRef, useState } from 'react'; +import PagerView from 'react-native-pager-view'; +import { TabBarDevice } from './components/TabBarDevice'; +import { TabsDevice } from './components/TabsDevice'; +import { ROOMS_AIR_PURIFIER_DATA, ROOMS_HEATING_DATA } from '../../../fixtures/devicesRooms'; + +interface TabDeviceProps { + deviceName: string; +} + +export const TabDevice = ({ deviceName }: TabDeviceProps) => { + const [activePage, setActivePage] = useState(0); + const pagerRef = useRef(null); + + const goToPage = (page: number) => { + pagerRef.current?.setPage(page); + }; + + const handlePageChange = (event: any) => { + setActivePage(event.nativeEvent.position); + }; + let DATA; + switch (deviceName) { + case 'Heating': + DATA = ROOMS_HEATING_DATA; + break; + + case 'Air Purifier': + DATA = ROOMS_AIR_PURIFIER_DATA; + break; + + default: + throw new Error(`invalid device name: ${deviceName}`); + } + + return ( + <> + + + + ); +}; diff --git a/examples/expo-example/src/components/partials/TabDevice/components/TabBarDevice.stories.tsx b/examples/expo-example/src/components/partials/TabDevice/components/TabBarDevice.stories.tsx new file mode 100644 index 00000000..8b010fe5 --- /dev/null +++ b/examples/expo-example/src/components/partials/TabDevice/components/TabBarDevice.stories.tsx @@ -0,0 +1,8 @@ +import type { Meta } from "@storybook/react"; +import { TabBarDevice } from "./TabBarDevice"; + +export default { + component: TabBarDevice, +} as Meta; + +export const Basic = {}; diff --git a/examples/expo-example/src/components/partials/TabDevice/components/TabBarDevice.tsx b/examples/expo-example/src/components/partials/TabDevice/components/TabBarDevice.tsx new file mode 100644 index 00000000..7822aed4 --- /dev/null +++ b/examples/expo-example/src/components/partials/TabDevice/components/TabBarDevice.tsx @@ -0,0 +1,48 @@ +import React from "react"; +import { FlatList, StyleSheet, TouchableOpacity, View } from "react-native"; +import Text from "../../../base/Text/Text"; +import { dimensions } from "../../../../theme/dimensions"; +import { RoomsAirPurifierItemProps, RoomsHeatingItemProps } from "../types"; + +interface HeaderControllProps { + goToPage: (page: number) => void; + activePage: number; + DATA: (RoomsHeatingItemProps | RoomsAirPurifierItemProps)[]; +} + +export const TabBarDevice = ({ + goToPage, + activePage, + DATA, +}: HeaderControllProps) => { + return ( + ( + { + goToPage(item.id); + }} + > + {item.id === activePage ? ( + {item.roomName} + ) : ( + {item.roomName} + )} + + )} + horizontal={true} + showsHorizontalScrollIndicator={false} + onEndReachedThreshold={0.1} + onStartReachedThreshold={0.25} + ItemSeparatorComponent={() => } + style={styles.container} + /> + ); +}; +const styles = StyleSheet.create({ + container: { + flexGrow: 0, + marginVertical: dimensions.tabsGap, + }, +}); diff --git a/examples/expo-example/src/components/partials/TabDevice/components/TabsDevice.stories.tsx b/examples/expo-example/src/components/partials/TabDevice/components/TabsDevice.stories.tsx new file mode 100644 index 00000000..48191339 --- /dev/null +++ b/examples/expo-example/src/components/partials/TabDevice/components/TabsDevice.stories.tsx @@ -0,0 +1,8 @@ +import type { Meta } from "@storybook/react"; +import { TabsDevice } from "./TabsDevice"; + +export default { + component: TabsDevice, +} as Meta; + +export const Basic = {}; diff --git a/examples/expo-example/src/components/partials/TabDevice/components/TabsDevice.tsx b/examples/expo-example/src/components/partials/TabDevice/components/TabsDevice.tsx new file mode 100644 index 00000000..bcff8564 --- /dev/null +++ b/examples/expo-example/src/components/partials/TabDevice/components/TabsDevice.tsx @@ -0,0 +1,73 @@ +import React from 'react'; +import SettingsButton from '../../SettingsButton/SettingsButton'; +import InfoDisplay from '../../InfoDisplay/InfoDisplay'; +import SettingsTime from '../../SettingsTime/SettingsTime'; +import { StyleSheet, View } from 'react-native'; +import { RoomsAirPurifierItemProps, RoomsHeatingItemProps } from '../types'; +import PagerView from 'react-native-pager-view'; +import ButtonPlusMinus from '../../ButtonPlusMinus/ButtonPlusMinus'; + +interface TabsDeviceProps { + deviceName: 'Heating' | 'Air Purifier'; + pagerRef: React.RefObject; + handlePageChange: (event: any) => void; + DATA: RoomsHeatingItemProps[] | RoomsAirPurifierItemProps[]; +} + +export const TabsDevice = ({ deviceName, pagerRef, handlePageChange, DATA }: TabsDeviceProps) => { + return ( + + {DATA.map((item) => ( + + + + + {deviceName === 'Heating' && ( + <> + + + + )} + {deviceName === 'Air Purifier' && ( + <> + + + + )} + + + ))} + + ); +}; + +const styles = StyleSheet.create({ + pagerView: { + flex: 1, + }, + infoContainer: { + flex: 1, + }, + statsContainer: { + flex: 1, + justifyContent: 'space-evenly', + }, + mockmiddlecomponent: { + height: 400, + backgroundColor: 'lightblue', + }, +}); diff --git a/examples/expo-example/src/components/partials/TabDevice/types.ts b/examples/expo-example/src/components/partials/TabDevice/types.ts new file mode 100644 index 00000000..3638d41c --- /dev/null +++ b/examples/expo-example/src/components/partials/TabDevice/types.ts @@ -0,0 +1,22 @@ +export interface RoomsHeatingItemProps { + id: number; + roomName: string; + airHumidity: number; + actualTemperature: number; + setTemperature: number; +} + +export interface RoomsHeatingProps { + DATA: RoomsHeatingItemProps[]; +} +export interface RoomsAirPurifierItemProps { + id: number; + roomName: string; + airQuality: number; + pm: number; + dust: number; +} + +export interface RoomsAirPurifierProps { + DATA: RoomsAirPurifierItemProps[]; +} diff --git a/examples/expo-example/src/components/partials/TutorialControll/TutorialControl.stories.tsx b/examples/expo-example/src/components/partials/TutorialControll/TutorialControl.stories.tsx new file mode 100644 index 00000000..22529ca2 --- /dev/null +++ b/examples/expo-example/src/components/partials/TutorialControll/TutorialControl.stories.tsx @@ -0,0 +1,26 @@ +import type { Meta } from '@storybook/react'; +import TutorialControl from './TutorialControl'; +import StoryDecorator from '../../../decorators/StoryDecorator'; + +export default { + component: TutorialControl, + decorators: [StoryDecorator], +} as Meta; + +type Story = { + args: { + appState: string; + }; +}; + +export const TutorialStage1: Story = { + args: { + appState: 'tutorial1', + }, +}; + +export const TutorialStage2: Story = { + args: { + appState: 'tutorial2', + }, +}; diff --git a/examples/expo-example/src/components/partials/TutorialControll/TutorialControl.tsx b/examples/expo-example/src/components/partials/TutorialControll/TutorialControl.tsx new file mode 100644 index 00000000..8eea0114 --- /dev/null +++ b/examples/expo-example/src/components/partials/TutorialControll/TutorialControl.tsx @@ -0,0 +1,53 @@ +import React from 'react'; +import { View, StyleSheet, TouchableOpacity } from 'react-native'; +import Text from '../../base/Text/Text'; +import { Dot } from '../../base/Icon/Icons/Dot'; +import { colors } from '../../../theme/colors'; + +interface TutorialControlProps { + appState: string; + setAppState: (value: string) => void; +} + +const TutorialControl = ({ appState, setAppState }: TutorialControlProps) => { + return ( + + + + + + + + setAppState(appState === 'tutorial1' ? 'tutorial2' : 'main')} + > + Skip + + + ); +}; + +export default TutorialControl; + +const styles = StyleSheet.create({ + container: { + flex: 0.2, + alignItems: 'center', + justifyContent: 'space-between', + width: 149.115, + }, + dotContainer: { + width: '100%', + flexDirection: 'row', + justifyContent: 'space-evenly', + }, + button: { + width: '100%', + padding: 17.042, + alignItems: 'center', + borderRadius: 17.219, + borderWidth: 1.722, + borderColor: colors.tutorialBtnBorder, + }, +}); diff --git a/examples/expo-example/src/components/partials/TutorialControll/index.ts b/examples/expo-example/src/components/partials/TutorialControll/index.ts new file mode 100644 index 00000000..ae005bd2 --- /dev/null +++ b/examples/expo-example/src/components/partials/TutorialControll/index.ts @@ -0,0 +1 @@ +export { default } from "./TutorialControl"; diff --git a/examples/expo-example/src/components/screens/ControllScreen/ControlScreen.tsx b/examples/expo-example/src/components/screens/ControllScreen/ControlScreen.tsx new file mode 100644 index 00000000..dc7fd6fd --- /dev/null +++ b/examples/expo-example/src/components/screens/ControllScreen/ControlScreen.tsx @@ -0,0 +1,33 @@ +import React from 'react'; +import { SafeAreaView, StyleSheet } from 'react-native'; +import Footer from '../../partials/Footer/Footer'; + +import Header from '../../partials/Header/Header'; +import { TabDevice } from '../../partials/TabDevice/TabDevice'; + +interface ControllScreenProps { + deviceName: 'Heating' | 'Air Purifier'; + setAppState: (value: string) => void; +} +export const ControlScreen = ({ deviceName, setAppState }: ControllScreenProps) => { + return ( + <> + +
console.log('Pressed')} + /> + + +