/** @jsx createIncorporatedElement */
import { ReactSource } from '@cycle/react';
import { run } from '@cycle/run';
import { createIncorporatedElement, makeInkDriver } from 'cycle-ink-driver';
import { Box } from 'ink';
import TextInput from 'ink-text-input';
import { Stream } from 'xstream';
const sels = {
name: Symbol('name'),
};
function View({ name }: { name: string }): JSX.Element {
return (
<Box flexDirection="column">
<Box>
Name: <TextInput sel={sels.name} value={name} onChange={() => {}} />
</Box>
{'-'.repeat(20)}
<Box>Hello {name}</Box>
</Box>
);
}
function main({ react }: { react: ReactSource }): { react: Stream<JSX.Element> } {
const name$ = react.select(sels.name).events('change').startWith('');
const view$ = name$.map((name) => View({ name }));
return {
react: view$,
};
}
const drivers = {
react: makeInkDriver(),
};
run(main, drivers);
-
Notifications
You must be signed in to change notification settings - Fork 0
Ink driver for Cycle.js
ryota-ka/cycle-ink-driver
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Ink driver for Cycle.js
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published