root = Card([header, goalStatus, progressSection, caloriesSection, workoutSection, logSection])
header = CardHeader("Daily Summary", "Tuesday, June 4")
goalStatus = Callout("success", "Step goal nearly met", "You are 85% of the way to your daily step goal.")
progressSection = Card([progressHeading, stepProgress, stepKpis], "sunk")
progressHeading = Heading("Steps Today", "h3")
stepProgress = Progress(85, "6,800 of 8,000 steps")
stepKpis = Table([kpiLabels, kpiValues])
kpiLabels = Col("Metric", ["Steps", "Distance", "Active minutes"])
kpiValues = Col("Value", ["6,800", "4.2 km", "32 min"])
caloriesSection = Card([caloriesHeading, caloriesChart], "sunk")
caloriesHeading = Heading("Calories Burned", "h3")
caloriesChart = SingleStackedBarChart(["Burned", "Goal"], [1850, 2200])
workoutSection = Card([workoutHeading, workoutChart, workoutSummary], "sunk")
workoutHeading = Heading("Workouts This Week", "h3")
workoutChart = BarChart(["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], [workoutSeries], "grouped", "Day", "Minutes")
workoutSeries = Series("Workout minutes", [45, 30, 60, 0, 50, 75, 40])
workoutSummary = TextContent("**5 workouts** this week, totaling **300 minutes**. Your best day was Saturday.", "small")
logSection = Card([logHeading, logForm])
logHeading = Heading("Log a New Workout", "h3")
logForm = Form("log-workout", logButtons, [typeField, durationField, intensityField])
typeField = FormControl("Workout type", typeSelect)
typeSelect = Select("type", [typeRun, typeRide, typeLift, typeYoga], "Select a type")
typeRun = SelectItem("run", "Running")
typeRide = SelectItem("ride", "Cycling")
typeLift = SelectItem("lift", "Strength")
typeYoga = SelectItem("yoga", "Yoga")
durationField = FormControl("Duration (minutes)", durationInput)
durationInput = Input("duration", "e.g. 45", "number")
intensityField = FormControl("Intensity", intensityRadio)
intensityRadio = RadioGroup("intensity", [intensityEasy, intensityMod, intensityHard], "moderate")
intensityEasy = RadioItem("Easy", "Low effort", "easy")
intensityMod = RadioItem("Moderate", "Steady pace", "moderate")
intensityHard = RadioItem("Hard", "High effort", "hard")
logButtons = Buttons([logSubmit])
logSubmit = Button("Log workout", null, "primary")