Bless You My dev
Improving the Developer eXperience
@m4d_zhttps://talks.m4dz.net/react-blessed/en/A Short History of Web Dev
The Power of PWA
The Web Platform, Browserless
The IoT Promise
We power our Devtools
with Node.js for a while
We need advanced interactions!
The Old Fashion Way
What about
Advanced UI?
What about
Data Visualization?
Facing the IoT Challenge
The Importance of Monitoring
Introducing TUi
TUi… but JavaScript.ed!
We have to craft
complex interfaces
React 🎉
React: Layout Engine
Rendering Abstraction: 🥳
react-blessed:
ASCII for React
Blessed w/ React
import React, {Component} from 'react';
import blessed from 'blessed';
import {render} from 'react-blessed';
const screen = blessed.screen({
autoPadding: true,
smartCSR: true,
title: 'react-blessed hello world'
});
Manage Layouts
class App extends Component {
render() {
return (
<box top="center"
left="center"
width="50%"
height="50%"
border={{type: 'line'}}>
Hello World!
</box>
);
}
}
const component = render(<App />, screen);
Widget Compositing
class Progress extends Component {
render() {
const {progress} = this.state
label = `Progress - ${progress}%`
return (
<box {...attrs}>
<box align="center">
{label}
</box>
<progressbar style={{bar: {bg: this.state.color}}}
filled={progress} />
</box>
);
}
}
Events Interaction
screen.key(['escape', 'q', 'C-c'], function(ch, key) {
return process.exit(0);
});
<progressbar style={{bar: {bg: this.state.color}}}
onComplete={() => this.setState({color: 'green'})}
filled={progress} />
Prompts and Forms
componentDidMount() {
this.refs.input.key(['enter'], (ch, key) => {
this.refs.input.submit()
})
}
render() {
return (
<box>
<list height="90%"
items={{this.state.items}} />
<textarea height="10%" bottom="0"
ref="input"
onSubmit={() => this.addItem(this.refs.input.getValue())}
onAction={() => this.refs.input.clearValue()} />
</box>
);
}
Large Widgets Collection
Advanced:
Choose your own renderer
import React, {Component} from 'react';
import blessed from 'neo-blessed';
import {createBlessedRenderer} from 'react-blessed';
const render = createBlessedRenderer(blessed);
Your superpower:
improve DX
Use React… Everywhere!
You’re not just
Web Devs anymore 🎉
Paranoïd Web Dino · Tech Evangelist
https://talks.m4dz.net/react-blessed/en/ Available under licence CC BY-SA 4.0
m4dz, CC BY-SA 4.0
Courtesy of Unsplash and Pexels contributors
Powered by Reveal.js
Source code available at
https://git.madslab.net/talks