@blueeast/bluerain-ui-interfaces
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

BlueRain UI Interfaces

A UI interfaces collection to align the components development process across all platforms. React components build using these interfaces supposedly should work on Web, Mobile (iOS and Android) and Desktop.

🎊 Status

Greenkeeper badge

Usage

Run the following command in the plugin directoy:

npm i --save @blueeast/bluerain-ui-interfaces

List of Interfaces

Following component interfaces have been defined and exposed through this repo.

Example Implementation of Interface

  • First export interface from bluerain-ui-interfaces repo.
import { TextInputProperties } from '@blueeast/bluerain-ui-interfaces';
  • Then extend/implement interface for component you intend to develop
export interface MUITextInputProperties extends TextInputProperties {
 autoComplete?: string,
 autoCorrect?: string,
 id?: string,
 label?: string,
 className?: any,
 margin?: 'none' |
    'dense' |
    'normal',
 required?: boolean,
 error?: boolean,
 type?: string,
 rowsMax?: string,
 rows?: string,
 helperText?: ReactNode,
 InputLabelProps?: object,
 fullWidth?: boolean,
 errorText?: ReactNode,
}
  • Then use above extended interface for component development
const BlueRainTextInput: React.StatelessComponent<MUITextInputProperties> = (rawProps) => {
 const { onChangeText , ...props } = rawProps;
 let disabled = false;
 if(props.editable !== undefined && !props.editable) {
  disabled = true;
 }
 return (
 <TextField
  onChange={(props.onChange || onChangeText) ? customOnChange(rawProps) : () => {return null;}}
  rows={props.numberOfLines}
  helperText={props.errorText}
  {...props}
 />
 );
};

export default BlueRainTextInput;

Notice how props from interface have been mapped to material-ui textinput props. For exmaple rows has been mapped numberOfLines.

Readme

Keywords

none

Package Sidebar

Install

npm i @blueeast/bluerain-ui-interfaces

Weekly Downloads

11

Version

4.0.0

License

ISC

Unpacked Size

553 kB

Total Files

57

Last publish

Collaborators

  • bluebase-release-bot
  • abubakarsaddique
  • artalat