0.0.2 ā€¢ Published 3 months ago

totology-open-source v0.0.2

Weekly downloads
-
License
Bouygues Telecom ...
Repository
-
Last release
3 months ago

Trilogy React

šŸš€ Quick Start


Project structure

.
ā”œā”€ā”€ config                  # Build / CI config
ā”œā”€ā”€ demo                    # Native / Web Demo views
ā”œā”€ā”€ docs                    # Storybook / TS documentation
ā”œā”€ā”€ lib                     # lib (dist) folder
ā”œā”€ā”€ mobile                  # Android / IOS Native root
ā”œā”€ā”€ scripts                 # Build scripts
ā”œā”€ā”€ styles                  # - Trilogy SCSS Styles
ā”œā”€ā”€ src                     # Source files
ā”‚   ā”œā”€ā”€ assets              # - Fonts
ā”‚   ā”œā”€ā”€ components       ā—€  # - React functional components
ā”‚   ā”œā”€ā”€ config              # React Native Config
ā”‚   ā”œā”€ā”€ context             # Trilogy Providers (styles / hashed styles)
ā”‚   ā”œā”€ā”€ events              # - Event type definitions
ā”‚   ā”œā”€ā”€ helpers             # - Utility functions
ā”‚   ā”œā”€ā”€ objects             # - Atoms & facets definition & implementation
ā”‚   ā”‚   ā”œā”€ā”€ atoms           #
ā”‚   ā”‚   ā””ā”€ā”€ facets          #
ā”‚   ā”œā”€ā”€ services            # - hooks
ā”œā”€ā”€ LICENSE
ā”œā”€ā”€ package.json            # Node package reference
ā”œā”€ā”€ tsconfig.json           # Typescript configuration
ā””ā”€ā”€ README.md

Quick Start šŸš€

šŸšØ Prerequisites

Web

Mobile (Android / IOS)

See how to setup your environment for Android and IOS

Development Setup

šŸ–„ļø Web

  • npm install: This script is used to install the dependencies of the project.
  • npm run start: This script is used to run the app in development mode.
  • npm run build: This deletes the 'lib' directory, runs the pre-build and builds the project before finishing up with other build tasks. You will need to run this script when you want to generate a production build of the app.
  • npm run build:css: This script uses webpack to compile the styles.
  • npm run storybook: This script is used to run the Storybook.
  • npm run build:storybook: This script is used for building the Storybook under the docs/storybook directory.

šŸ“± Mobile (Android / IOS)

  • npm run postinstall:native: This script is used to install the dependencies of the native app.
  • npm run start:native: This script is used to run the app in development mode.

šŸ§° Development experience

  • npm run lint: This script is used to maintain code quality by checking for style writing errors in the code.
  • npm run test: This script is used to run Jest tests.

āœØ Trilogy Provider Usage šŸ™‹

The TrilogyProvider simplifies integrating Trilogy style into your app by wrapping your entry point with a provider. It offers two props for customization:

  • mangled [optionnal]: Apply compressed styling for performance.
  • injectTrilogyAssets: Inject Trilogy assets directly into the DOM.

Usage

Import the TrilogyProvider component:

import {TrilogyProvider} from "@bytel/trilogy-react-ts";

Wrap your app's root component with TrilogyProvider:

  <TrilogyProvider mangled injectTrilogyAssets>
        <Router>
          {routeComponents}
        </Router>
    </TrilogyProvider>

Android Setup

See šŸ‘‰ https://reactnative.dev/docs/environment-setup

1. Node & Watchman

Make sure you have installed Node + Watchman :

brew install node

brew install watchman

1.1. Java Development Kit

ARM / Intel Hybrid Compatible Distribution :

brew tap homebrew/cask-versions

brew install --cask zulu11

1.2. Install Android Studio

See šŸ‘‰ https://developer.android.com/studio

2. Install the Android SDK

  • Appearance & Behavior ā†’ System Settings ā†’ Android SDK

  • Install : Android 13 (Tiramisu) (Version Compatible ARM + Intel)

  • Then Create New Device and select "Android 13 (Tiramisu)"

3. Configure the ANDROID_HOME environment variable

Add the following lines to your ~/.zprofile or ~/.zshrc (if you are using bash, then ~/.bash_profile or ~/.bashrc) config file:

export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools

4. Run Android App

cd mobile
npm i         # Install all node dependencies
npm run android | npm start # Start and launch the android simulator

Run Native Project

cd mobile
npm i         # Install all node dependencies
npm run ios | npm start   # Start and launch the ios simulator

Install

npm i @bytel/trilogy-react-ts
# or
yarn add @bytel/trilogy-react-ts

Sample Use WEB / NATIVE

import { Button, Text } from '@bytel/trilogy-react-ts'

<Button variant='PRIMARY'>My Button</Button>
<Text level='1'>My Text</Text>

Launch Components Documentation

Based on JSDOC components

npm run start:docs