-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): Adding work in stasis Dialog/Drawer Components. Als…
…o longer webpack build trigger
- Loading branch information
Showing
9 changed files
with
149 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,5 @@ run(main, { | |
AttrsModule, ClassModule, | ||
HeroModule, EventsModule | ||
] | ||
}) | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Observable as $ } from 'rx'; | ||
const { div, p } = require('cycle-snabbdom'); | ||
//import { Button } from '@eldarlabs/cycle-ui'; | ||
const isolate = require('@cycle/isolate'); | ||
import { Button } from '@eldarlabs/cycle-ui'; | ||
|
||
// function Button({DOM, label$, value$}) { | ||
// const click$ = DOM.select('button').events('click') | ||
// .flatMapLatest(() => value$); | ||
// | ||
// const view$ = label$.map((label: any) => { | ||
// return button({}, label); | ||
// }); | ||
// | ||
// return { | ||
// click$, | ||
// DOM: view$ | ||
// }; | ||
// } | ||
|
||
export function Counter3(sources: any) { | ||
const { DOM } = sources; | ||
|
||
const decrement: any = Button(sources, | ||
{ isolate: true, className: 'decrement', label: 'Decrement' }); | ||
const increment = Button(sources, | ||
{ isolate: true, className: 'increment', label: 'Increment' }); | ||
|
||
const action$ = $.merge( | ||
DOM.select('.counter').select('.decrement').events('click').map( (ev: any) => -1), | ||
DOM.select('.counter').select('.increment').events('click').map( (ev: any) => +1) | ||
); | ||
|
||
//const action$ = decrement.click$.merge(increment.click$); | ||
const count$ = action$.startWith(0).scan((x: any, y: any) => x + y); | ||
|
||
const view$ = count$.combineLatest(decrement.DOM, increment.DOM, | ||
(count: any, dec: any, inc: any) => div('.counter', {}, [ | ||
dec, | ||
inc, | ||
p({}, `Counter: ${count}`) | ||
]) | ||
); | ||
|
||
return { | ||
DOM: view$ | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { Button, Card, CardText, CardTitle, Drawer, Input } from '@eldarlabs/cycle-ui'; | ||
import { Observable as $ } from 'rx'; | ||
const { p, h5 } = require('cycle-snabbdom'); | ||
//import { CycleComponent } from '@eldarlabs/cycle-ui/helpers/cycleDomInterfaces'; | ||
import { DemoCardView } from '../../../components/DemoCard'; | ||
|
||
export function Drawers(sources: any) { | ||
const DOM = sources.DOM; | ||
|
||
const showDrawerClick$ = DOM.select('.showDrawer').events('click'). | ||
map( (ev: Event) => 'show'). | ||
do((x: any) => console.log('show: ' + x)); | ||
|
||
const drawerClose$ = sources.DOM.select('dialog').events('close'). | ||
startWith(false). | ||
map(() => false). | ||
do((x: any) => console.log('drawerCloseFromApp: ' + x)); | ||
|
||
const isDrawerActive$: $<boolean> = $.merge<boolean>( | ||
showDrawerClick$.map(true) | ||
, drawerClose$.map(false) | ||
).startWith(false); | ||
|
||
function view(isDrawerActive: boolean) { | ||
const drawer = ( | ||
Drawer(sources, { isolate: false, className: 'drawer', active: isDrawerActive, type: 'left' }, [ | ||
h5('This is a left drawer'), | ||
p('A drawer can have multiple children controls'), | ||
Input(sources, { label: 'Input in a Drawer' }).DOM, | ||
]) | ||
); | ||
|
||
// (<any>drawer).closeEvent$.subscribe( (x: any) => { | ||
// console.log('close obs event: ' + x); | ||
// }); | ||
|
||
return ( | ||
Card(sources, { isolate: false, className: 'demoDrawers' }, [ | ||
CardTitle(sources, { isolate: false, title: 'Drawers (Work in progress)' }, [ | ||
CardText(sources, { isolate: true }, [ | ||
Button(sources, { isolate: false, className: 'showDrawer', label: 'Show Drawer', | ||
raised: true }).DOM, | ||
p('is active: ' + isDrawerActive), | ||
drawer.DOM, | ||
]).DOM | ||
]).DOM | ||
]).DOM | ||
); | ||
} | ||
|
||
const vtree$ = ( | ||
// $.combineLatest(drawerClose$, isDrawerActive$, (drawerClose: boolean, isDrawerActive: boolean) => { | ||
isDrawerActive$.map( (isDrawerActive: boolean) => { | ||
return view(isDrawerActive); | ||
}) | ||
); | ||
|
||
return { | ||
DOM: vtree$, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters