0.12.3 • Published 6 years ago

@5rabbits/dms v0.12.3

Weekly downloads
68
License
MIT
Repository
github
Last release
6 years ago

DMS React Component

Usage

  • Install with yarn add @5rabbits/dms.
  • Install peer dependencies (if you haven't already) yarn add react@^16.0.0 react-dom@^16.0.0 mobx@^3.1.2 mobx-react@^4.3.3. React 15 is also supported.
  • Use the DMS component:
import DMS from '@5rabbits/dms'
import '@5rabbits/dms/dist/dms.css'

<DMS
  apiHost="https://my-api.com"
  apiToken="some-auth-token"
/>

Props

proptypedefaultrequireddescription
apiHoststringyesThe host where all requests will be made.
apiTokenstringyesThe token that will be sent as header Authorization: Bearer TOKEN on every request.
localestring'en'Language to display the component. en and es are supported by default, but you can add other languages using the translations prop.
translationsobjectExtra locales for the component. Use this file as a template and pass the translations as { [locale]: [translations] }.
routerTypememory, browser, hashmemorySpecifies where the component should persist the inner routing.
defaultRoutestring'/'(memory router only) The initial route the component will render. At the moment you can use://files (alias of /)/recent/deleted/(files\|recent\|deleted)/:itemID (the first segments is used to highlight the corresponding sidebar section)
onRouteChangefuncCallback that will be invoked every time the internal route changes. The first argument will be the new route string.
baseRoutestring(browser and hash routers only) The base url segment for browser based routes.
onErrorfunc(React 16 only) Callback that will be invoked if the DMS component crashes and recovers itself. The first argument is the exception and the second one is the React components stack. This is provided for error tracking purposes.