|
| 1 | +import { view, tags, render } from "@commontools/common-ui"; |
| 2 | +const { dict, datatable, vstack, hstack, checkbox, div } = tags; |
| 3 | + |
| 4 | +const datatableNode = datatable({ |
| 5 | + cols: [ |
| 6 | + "title", |
| 7 | + "day", |
| 8 | + "time", |
| 9 | + "location", |
| 10 | + "address", |
| 11 | + "description", |
| 12 | + "level", |
| 13 | + "price", |
| 14 | + "email", |
| 15 | + "reservation", |
| 16 | + ], |
| 17 | + rows: [ |
| 18 | + { |
| 19 | + title: "Power Yoga", |
| 20 | + day: "Monday", |
| 21 | + time: "8:00am", |
| 22 | + location: "Studio 1 & 2 (combined)", |
| 23 | + description: |
| 24 | + "Stretch and relax with yoga practice at the studio. All levels welcome. Bring your own mat. Namaste. 🧘♂️", |
| 25 | + level: "Beginner to Advanced", |
| 26 | + price: "$10", |
| 27 | + address: "1234 Elm St, Springfield, IL 62701", |
| 28 | + email: "yogazon124@example.com", |
| 29 | + reservation: "https://example.com/reserve/power-yoga", |
| 30 | + }, |
| 31 | + { |
| 32 | + title: "Pilates", |
| 33 | + day: "Wednesday", |
| 34 | + time: "8:00am", |
| 35 | + location: "Studio", |
| 36 | + description: "Strengthen and tone", |
| 37 | + level: "Intermediate", |
| 38 | + price: "$15", |
| 39 | + address: "1234 Elm St, Springfield, IL 62701", |
| 40 | + email: "pilates14asdf@example.com", |
| 41 | + reservation: "https://example.com/reserve/pilates", |
| 42 | + }, |
| 43 | + { |
| 44 | + title: "Zumba", |
| 45 | + day: "Friday", |
| 46 | + time: "8:00am", |
| 47 | + location: "Studio", |
| 48 | + description: "Dance and have fun", |
| 49 | + level: "Advanced", |
| 50 | + price: "$20", |
| 51 | + address: "1234 Elm St, Springfield, IL 62701", |
| 52 | + email: "zumba@example.com", |
| 53 | + reservation: "https://example.com/reserve/zumba", |
| 54 | + }, |
| 55 | + ], |
| 56 | +}); |
| 57 | + |
| 58 | +const dictNode = dict({ |
| 59 | + records: { |
| 60 | + one: "1", |
| 61 | + two: "2", |
| 62 | + three: "3", |
| 63 | + }, |
| 64 | +}); |
| 65 | + |
| 66 | +const todoItems = [ |
| 67 | + { title: "Buy groceries", done: false }, |
| 68 | + { title: "Walk the dog", done: true }, |
| 69 | + { title: "Wash the car", done: false }, |
| 70 | +]; |
| 71 | + |
| 72 | +const todos = vstack( |
| 73 | + {}, |
| 74 | + ...todoItems.map((item) => hstack({}, checkbox({}), div({}, item.title))) |
| 75 | +); |
| 76 | + |
| 77 | +const tree = vstack({}, todos, datatableNode, dictNode); |
| 78 | + |
| 79 | +const element = render.render(tree, {}); |
| 80 | + |
| 81 | +document.body.appendChild(element); |
0 commit comments