@ouroboros/mouth-mui
v2.1.2
Published
Components for use with the Mouth service
Maintainers
Readme
@ouroboros/mouth-mui
Material-UI Components for interacting with the mouth2_oc service. It uses @ouroboros/mouth to handle the actual connections.
See Releases for changes from release to release.
Installation
foo@bar:~$ npm install @ouroboros/mouth-muiUsing mouth-mui
If you're using react with material-ui, this library provides components for creating and editing locales and templates.
Components
Locales
Locales is used to setup allowable locales on the system, as well as to make
it easier to look up what locales can be chosen. It handles all C.R.U.D.
operations.
import { Locales } from '@ouroboros/mouth-mui';
import React from 'react';
import { addError, addMessage } from 'your_module';
function MyLocalesPage(props) {
return <Locales
onError={addError}
onSuccess={(type) => {
/* type includes [
'create', 'delete', 'update',
] */
addMessage(`${type} successful!`)
}}
/>
}| Prop | Type | Optional | Description |
| ---- | ---- | -------- | ----------- |
| onError | error => void | yes | Callback for when an error occurs. error is a responseErrorStruct from @ouroboros/body. |
| onSuccess | type => void | yes | Callback for when any of the following types happen: 'create', 'delete', and 'update'. |
[ top / components ]
Templates
Templates is used to setup named templates with individual versions per locale
and method (content). For example, you could make a template with both email
content and sms content so that depending on the user's preference you have
both. Or you could have an email with both English and Spanish content. Or you
could have all instances and have multiple locales setup for both email and sms.
The component handles creating and updating for all these variations.
import { Templates } from '@ouroboros/mouth-mui';
import React from 'react';
import { addError, addMessage } from 'your_module';
function MyTemplatesPage(props) {
return <Templates
onError={addError}
onSuccess={(type) => {
/* type includes [
'template_create', 'template_update',
'content_create', 'content_update'
] */
addMessage(`${type} successful!`)
}}
/>
}| Prop | Type | Optional | Description |
| ---- | ---- | -------- | ----------- |
| onError | error => void | yes | Callback for when an error occurs. error is a responseErrorStruct from @ouroboros/body. |
| onSuccess | type => void | yes | Callback for when any of the following types happen: 'template_create', 'template_update', 'content_create','content_update'. |
[ top / components ]
