class Box {
constructor() {
}
onMount() {
}
render() {
return nativeElement('box', this.props, this.styles, this.children)
}
}
class Text {
constructor() {
}
onMount() {
}
render() {
return nativeElement('text', this.props, this.styles, [])
}
}
class Button {
constructor() {
}
onMount() {
}
render() {
return nativeElement('button', this.props, this.styles, [])
}
}
class Tabs {
constructor() {
}
onMount() {
}
render() {
return nativeElement('tabs', this.props, this.styles, this.children)
}
}
class PrimaryTab {
constructor() {
}
onMount() {
}
render() {
return nativeElement('primary-tab', this.props, this.styles, this.children)
}
}
class Food {
constructor() {
this.state = {
count: this.props.food.count
}
}
onMount() {
}
render() {
return (
)
}
}
class Test {
constructor() {
this.state = {
total: 0,
selectedCategoryId: 'pizza',
menu: {
pizza: [
{
id: 'pizza 1',
description: 'bla bla bla',
tag: 'a tag ...',
count: 0,
price: 16
},
{
id: 'pizza 2',
description: 'bla bla bla',
tag: 'a tag ...',
count: 0,
price: 32
},
{
id: 'pizza 3',
description: 'bla bla bla',
tag: 'a tag ...',
count: 0,
price: 16
},
{
id: 'pizza 4',
description: 'bla bla bla',
tag: 'a tag ...',
count: 0,
price: 32
},
{
id: 'pizza 5',
description: 'bla bla bla',
tag: 'a tag ...',
count: 0,
price: 16
},
{
id: 'pizza 6',
description: 'bla bla bla',
tag: 'a tag ...',
count: 0,
price: 32
}
],
pasta: [
{
id: 'pasta 1',
description: 'bla bla bla',
tag: 'a tag ...',
count: 0,
price: 48
},
{
id: 'pasta 2',
description: 'bla bla bla',
tag: 'a tag ...',
count: 0,
price: 64
}
]
}
}
}
onMount() {
}
render() {
let cats = Object.keys(this.state.menu)
return (
{
this.state.selectedCategoryId = cats[e.target.activeTabIndex]
this.setState(this.state)
}} style={{ borderRadius: 28, boxShadow: 'rgba(0, 0, 0, 0.16) 0px 1px 4px' }}>
{
cats.map(cat => {
return
})
}
{
this.state.menu[this.state.selectedCategoryId].map(food => {
return (
{
food.count = count
let cats = Object.keys(this.state.menu)
let total = 0
cats.forEach(cat => {
let foods = this.state.menu[cat]
foods.forEach(food => {
total += (food.price * food.count)
})
})
this.state.total = total
this.setState(this.state)
}} />
)
})
}
{
console.log({ order: this.state.menu, total: this.state.total })
}} />
)
}
}