DOM: stuff$.map(([products, selected]) =>
   products ? div('.container', [
     hr(),
     button('.btn.btn-sm', 'Reload eWinery JSON Feed'),
     h1('Digivino Marketing Shortcodes'),
     `You have selected ${selected.length || 0} of the ${products.length || 0} products provided by eWinery`,
     hr(),
     div('.form-group', [
       label('Search'),
       input('#search.form-control', {props: {type: 'search'}}),
     ]),
     br(),
     ul('.list-unstyled.list-group', [
       li('list-group-item', div(['what the f**k'])),
       ...selected.map(each => li([
         b(each.PRODUCTNAME),
         span(` SKU ${each.PRODUCTSKU} (${each.TYPE})`),
         br(),
         ul('.list-unstyled.list-group', [
           ...each.TYPE === 'Kit' ?  [
             li('.list-group-item', `[Buy1Kit id="${each.PRODUCTID}" price="${each.PRICE1}]"`),
             li('.list-group-item', `[ReturnToSpecials]`)
           ] : [
             li('.list-group-item', `[Buy1Bottle id="${each.PRODUCTID}" price="${each.PRICE1}"]`),
             li('.list-group-item', `[Buy1Case id="${each.PRODUCTID}" price="${each.PRICE2}"]`),
             li('.list-group-item',  `[ReturnToShop]`)
           ]
         ])
       ]))
     ])
   ]) :
   div('.container.jumbotron', [
     h1('Loading eWinery JSON stream...')
   ])
 .map(([backButton, contents]) =>
   div([
     backButton,
     h2(`.${className}`, ['Details']),
     hr(),
     ...contents
   ])
示例#3
0
文件: app.ts 项目: FarhodKurbonov/FRP
 .map(name =>
   div('#root', [
     label('Name:'),
     input('.field', { attrs: { type: 'text', value: name } }),
     hr(),
     h1(name ? `Hello, ${name}!` : 'Hello! Please enter your name...'),
   ])
 return {DOM: state$.map(state =>
   div('.container', {props: {style: 'margin: 1pc'}}, [
     div(state),
     div('.form', {props: {style: 'outline: 1pt solid blue; padding: 1pc'}}, [
       div('.form-group', [
         label({props: {for: 'username'}}, 'Username'),
         input('#username.form-control', {props: {type: 'text', autofocus: true}}),
       ]),
       div('form-group', [
         label({props: {for: 'password'}}, 'Password'),
         input('#password.form-control', {props: {type: 'password'}}),
       ]),
       hr(),
       div('.form-group', [
         button('#login.form-control.btn.btn-primary', 'Log In')
       ])
     ])
   ])
 .map(([headerDom, component]) =>
   div(`.header.layout.${className}`, [
     header(headerDom),
     hr(),
     main(component)
   ])