1.1.6 • Published 2 years ago

use-up v1.1.6

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Use Up

Why ?

🥸 : Bootstrapping a project is unexpectedly very difficult because there are so many choices, too many setups and configs to do before just working on a project...

😩 : "Hell yeah, you're right. Javascript fatigue..."

🥸 : Up React help you to have everything you need to start for creating a webapp as simple as that :

🧐 : "Mmh, interesting..."

🥸 : At the best, you can just use our components or layouts making a breeze for your quick prototyping or web development with everything to start included and UP to date.

🧐 : "Mmh, yes but what if I want to..."

🥸 : Shut ! I know your dev syndrom... At the minimum, you will have a good boilerplate and UP to you to override it when you will feel the need. Thanks to our "convention over configuration philosophy" and S.O.L.I.D principle :-).

😁 : "Ok now I want to start !!!"

Getting started

There is also a Next.js boilerplate available here : https://github.com/uptoolkit/upfront-nextjs

In your React project just make :

yarn add use-up #or npm i use-up --save

REM : for more tools to use => you can check out also up-react https://github.com/uptoolkit/up-react

Then in your main app (likely very soon in your app instanciation), do :

// this will be likely in your main.js or pages/__app.js in Next
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import {useUp} from 'use-up';

//1. You must instanciate the useUp singleton
useUp({
  debug: true,
  project : {
    name: 'Up Toolkit Demo',
    logo: {
      src: '/img/logo.svg',
    },
    url: '/'
  },
  storeMode: 'reactive', // could be reactive|redux
  api: {
    url: 'https://uptoolkit/demo/api', // Replace with your api endpoint
  },
  translations: {
    en_EN: {
      hello: 'Hello World !',
    },
    fr_FR: {
      hello: 'Bonjour le monde',
    },
  },
  locale: 'en_EN',
  locales: [
    'en_EN', 'fr_FR'
  ],
});

ReactDOM.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>,
  document.getElementById('root')
)

Then in your component you can simply use the useUp() helper :

import {useState} from 'react'
import {useUp} from 'use-up';

function App() {

  const {
    config, // config helper
    api, // api helper
    t, // translation helper
  } = useUp();

  return (
    <div className="App">
      <header className="App-header">
        {config.get('project.name')}
        {t('hello')}
      </header>
    </div>
  )
}

Available variable helpers

PropertiesDescriptionLink
configConfig Helperhttps://www.npmjs.com/package/js-config-helper
httpAxios instancehttps://axios-http.com/
apiAxios instance with your api as baseUrlhttps://axios-http.com/
i18nI18n Helperhttps://www.npmjs.com/package/@cherrypulp/i18n
formForm validation helperhttps://www.npmjs.com/package/js-form-helper
formApiForm validation helper with your Api as baseUrlhttps://www.npmjs.com/package/js-form-helper
messageMessage helper from AntDesign Uihttps://ant.design/components/message/
notificationNotification helper from AntDesign Uihttps://ant.design/components/notification/

What if I need to adapt or don't need a components ?

UseUp use a convention over configuration principle but also a S.O.L.I.D design pattern.

It means that you can override everything if you follow the Typed interface conventions.

To override an element in your initialisation config, just do :

useUp({
  override: {
    api: MyCustomApiService,
    message: MyOtherMessagePlugin
  },
  exclude: [
    'notification',
    'i18n'
  ]
});

Digging deeper

You can get full documentation or check our complete example :

Discover the whole ecosystem of Up Toolkit

UseUp is a part of the Up Toolkit ecosystem a set of packages and utilities for change makers.

For more information go to :

How to contribute ?

Everyone can contribute and propose any components or post an issues, make a suggestion :

To dos :

  • Testing using Jest
  • Add Apollo GraphQL Client helper
  • Customising AntDesign style
  • Documenting code
  • Setting up Storybook
  • More typehint and typescript
  • Add more useful components and libs :-)

Any helps wanted !

Support us

Support us on Open Collective or buy us a Tree :

License

MIT

Treeware license

This package is also a Treeware.

If you use it in production, then we kindly ask buy the world a tree to thank us for our work.

By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats!

1.1.6

2 years ago

1.1.5

2 years ago

1.1.1

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0

3 years ago

1.0.48

3 years ago

1.0.47

3 years ago

1.0.46

3 years ago

1.0.45

3 years ago

1.0.44

3 years ago

1.0.43

3 years ago

1.0.42

3 years ago

1.0.41

3 years ago

1.0.40

3 years ago

1.0.39

3 years ago

1.0.38

3 years ago

1.0.37

3 years ago

1.0.36

3 years ago

1.0.35

3 years ago

1.0.34

3 years ago

1.0.33

3 years ago

1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago