Coder Social home page Coder Social logo

aloompa / mobile-first-navigation Goto Github PK

View Code? Open in Web Editor NEW
4.0 4.0 2.0 2.81 MB

A React navigational router with an emphasis on being Mobile and Developer friendly ๐Ÿ“ฑ

License: GNU General Public License v3.0

JavaScript 22.35% TypeScript 76.79% HTML 0.86%
react router mobile web mobile-web mobile-optimized mobilefirst mobilefirstnavigation

mobile-first-navigation's Introduction

Mobile First Navigation Monorepo

A navigational router with an emphasis on being Mobile and Developer friendly ๐Ÿ“ฑ

Packages

Mobile First Router

demo

Coming soon...

install

npm i @aloompa/mobile-first-router

configuration

Standard
import Home from './routes/Home';
import Modal from './routes/Modal';
import Page2 from './routes/Page2';
import Page2b from './routes/Page2b';
import Page3 from './routes/Page3';
import { createRoutes } from '@aloompa/mobile-first-router';
import { TopNav } from '@aloompa/mobile-first-components';

export const routeConfig = {
  initialRoute: 'Home',
  routes: {
    Home: {
      route: Home,
      getTitle: () => 'Home'
    },
    Page2: {
      route: Page2,
      getTitle:  () => 'Page 2'
    },
    Page2b: {
      route: Page2b,
      getTitle:  () => 'Page 2b'
    },
    Page3: {
      route: Page3,
      getTitle:  () => 'Page 3'
    },
    Modal: {
      route: Modal,
      getTitle: () => 'Modal Page',
      mode: 'modal'
    }
  },
  renderTopNav: TopNav
};

const Routes = createRoutes(routeConfig);

export default Routes;
With Tabs
import * as React from 'react';
import Home from './routes/Home';
import Modal from './routes/Modal';
import Page2 from './routes/Page2';
import Page2b from './routes/Page2b';
import Page3 from './routes/Page3';
import { createRoutes } from '@aloompa/mobile-first-router';
import { TabButton, TopNav } from '@aloompa/mobile-first-components';

export const routeConfig = {
  initialActiveTab: 1,
  initialRoute: 'Home',
  tabs: [
    {
      button: (isSelected: boolean, onPress: Function) => (
        <TabButton
          selected={isSelected}
          onPress={onPress}
          iconUnselectedColor={'#ccc'}
          iconHeight={18}
          iconWidth={20}
          iconSelectedColor={'#FF00FF'}
          title={'Browse'}
          iconUrl={
            'https://aloompa-assets.imgix.net/TestFolder/reservations-tab-icon-browse.svg'
          }
        />
      ),
      initial: 'Home'
    },
    {
      button: (isSelected: boolean, onPress: Function) => (
        <TabButton
          selected={isSelected}
          onPress={onPress}
          iconUnselectedColor={'#ccc'}
          iconHeight={18}
          iconWidth={22}
          iconSelectedColor={'#FF00FF'}
          title={'Home 2'}
          iconUrl={
            'https://aloompa-assets.imgix.net/TestFolder/reservations-tab-icon-tickets.svg'
          }
        />
      ),
      initial: 'Page2'
    },
    {
      button: (isSelected: boolean, onPress: Function) => (
        <TabButton
          selected={isSelected}
          onPress={onPress}
          iconUnselectedColor={'#ccc'}
          iconHeight={22}
          iconWidth={22}
          iconSelectedColor={'#FF00FF'}
          title={'Page 3'}
          iconUrl={
            'https://aloompa-assets.imgix.net/TestFolder/reservations-tab-icon-account.svg'
          }
        />
      ),
      initial: 'Page3'
    }
  ],
  routes: {
    Home: {
      route: Home,
      getTitle: () => 'Home'
    },
    Page2: {
      route: Page2,
      getTitle:  () => 'Page 2'
    },
    Page2b: {
      route: Page2b,
      getTitle:  () => 'Page 2b'
    },
    Page3: {
      route: Page3,
      getTitle:  () => 'Page 3'
    },
    Modal: {
      route: Modal,
      getTitle: () => 'Modal Page',
      mode: 'modal'
    }
  },
  renderTopNav: TopNav
};

const Routes = createRoutes(routeConfig);

export default Routes;
import * as React from 'react';

import Routes from './Routes';

const App = () => <Routes />;

export default App;

Mobile First Components

install

npm i @aloompa/mobile-first-components

Developing locally

yarn run build

yarn run example

Publish

yarn run release

Mobile First Storybook

live storybook demo and documentation

Coming soon...

For now:

yarn run build

yarn run storybook

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.