Week Menu
Meal delivery as a week: one column per day with its meal.
Install
npx ui8kit add week-menuPulls in: box, compose, dish-showcase, empty-state, group, inline, kit-box, kit-text, media-frame, restaurant-menu, section-frame, stack, text, utils
Preview
Meals for the week
One fresh meal a day, delivered the evening before.
Monday
Delivered Sunday evening
Chicken with rice
420 g
$9.90Tuesday
Delivered Monday evening
Beef stew
450 g
$11.90Wednesday
Delivered Tuesday evening
Vegetable lasagna
400 g
$10.90Thursday
Delivered Wednesday evening
Salmon and greens
380 g
$13.90Friday
Delivered Thursday evening
Turkey meatballs
420 g
$10.90Code
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdnnpx ui8kit add week-menu<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Meal delivery as a week: one column per day (its name and delivery note) with the meal of that day as a small
card (picture, name, weight, price). Axes: media (image, none), tone.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishSection } from "./restaurant-menu.types";
export type WeekMenuProps = {
id: string;
title: string;
lead?: string;
dishes: Dish[];
sections: DishSection[];
empty?: string;
labels: FoodLabels;
media?: "image" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Group from "../compose/Group.svelte";
import Inline from "../compose/Inline.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import EmptyState from "../components/empty-state.svelte";
import MediaFrame from "../components/media-frame.svelte";
import SectionFrame from "../components/section-frame.svelte";
import { fmtMoney } from "../utils";
let {
id,
title,
lead = "",
dishes,
sections,
empty = "",
labels,
media = "image",
tone = "default",
landmarkLabel,
}: WeekMenuProps = $props();
</script>
<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
{#if ((sections?.length ?? 0) === 0)}
<EmptyState icon="calendar" title={empty} />
{:else}
<Box class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5" data-slot="items">
{#each sections as s (s.id)}
<Stack gap="2" class="border-t-2 border-primary pt-4" data-slot="day">
<Text size="sm" weight="semibold">
{s.title}
</Text>
<Text size="xs" class="text-muted-foreground">
{s.note}
</Text>
{#each dishes as d (d.id)}
{#if (d.tag === s.key)}
<Stack gap="2" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
{#if ((media as string) === "image")}
<MediaFrame alt={d.name} src={d.image} ratio="4/3" />
{/if}
<Text size="sm" weight="semibold">
{d.name}
</Text>
<Group gap="2" align="baseline" justify="between">
<Text size="xs" class="text-muted-foreground">
{d.weight}
</Text>
<Inline class="text-sm font-bold">
{fmtMoney(d.price, d.currency)}
</Inline>
</Group>
</Stack>
{/if}
{/each}
</Stack>
{/each}
</Box>
{/if}
</SectionFrame>
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdnnpx ui8kit add week-menu// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Meal delivery as a week: one column per day (its name and delivery note) with the meal of that day as a small
* card (picture, name, weight, price). Axes: media (image, none), tone.
*/
import { Fragment, type ReactNode } from "react";
import { Box, Group, Inline, Stack, Text } from "../compose";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { fmtMoney } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishSection } from "./restaurant-menu.types";
export type WeekMenuProps = {
id: string;
title: string;
lead?: string;
dishes: Dish[];
sections: DishSection[];
empty?: string;
labels: FoodLabels;
media?: "image" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function WeekMenu({
id,
title,
lead = "",
dishes,
sections,
empty = "",
labels,
media = "image",
tone = "default",
landmarkLabel,
}: WeekMenuProps) {
return (
<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
{((sections?.length ?? 0) === 0) ? (
<EmptyState icon="calendar" title={empty} />
) : (
<Box className="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5" data-slot="items">
{(sections ?? []).map((s) => (
<Stack key={s.id} gap="2" className="border-t-2 border-primary pt-4" data-slot="day">
<Text size="sm" weight="semibold">
{s.title}
</Text>
<Text size="xs" className="text-muted-foreground">
{s.note}
</Text>
{(dishes ?? []).map((d) => (
<Fragment key={d.id}>
{(d.tag === s.key) ? (
<Stack gap="2" className="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
{((media as string) === "image") ? (
<MediaFrame alt={d.name} src={d.image} ratio="4/3" />
) : null}
<Text size="sm" weight="semibold">
{d.name}
</Text>
<Group gap="2" align="baseline" justify="between">
<Text size="xs" className="text-muted-foreground">
{d.weight}
</Text>
<Inline className="text-sm font-bold">
{fmtMoney(d.price, d.currency)}
</Inline>
</Group>
</Stack>
) : null}
</Fragment>
))}
</Stack>
))}
</Box>
)}
</SectionFrame>
);
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdnnpx ui8kit add week-menu<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
Meal delivery as a week: one column per day (its name and delivery note) with the meal of that day as a small
card (picture, name, weight, price). Axes: media (image, none), tone.
-->
<script lang="ts">
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishSection } from "./restaurant-menu.types";
export type WeekMenuProps = {
id: string;
title: string;
lead?: string;
dishes: Dish[];
sections: DishSection[];
empty?: string;
labels: FoodLabels;
media?: "image" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Group from "../compose/Group.vue";
import Inline from "../compose/Inline.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import EmptyState from "../components/empty-state.vue";
import MediaFrame from "../components/media-frame.vue";
import SectionFrame from "../components/section-frame.vue";
import { fmtMoney } from "../utils";
const {
id,
title,
lead = "",
dishes,
sections,
empty = "",
labels,
media = "image",
tone = "default",
landmarkLabel,
} = defineProps<WeekMenuProps>();
</script>
<template>
<SectionFrame :id="id" :title="title" :lead="lead" :tone="tone" :landmarkLabel="landmarkLabel">
<EmptyState v-if="((sections?.length ?? 0) === 0)" icon="calendar" :title="empty" />
<Box v-else class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5" data-slot="items">
<Stack v-for="s in sections" :key="s.id" gap="2" class="border-t-2 border-primary pt-4" data-slot="day">
<Text size="sm" weight="semibold">
{{ s.title }}
</Text>
<Text size="xs" class="text-muted-foreground">
{{ s.note }}
</Text>
<template v-for="d in dishes" :key="d.id">
<Stack
v-if="(d.tag === s.key)"
gap="2"
class="rounded bg-card inset-ring inset-ring-border p-4"
data-slot="item"
>
<MediaFrame v-if="((media as string) === 'image')" :alt="d.name" :src="d.image" ratio="4/3" />
<Text size="sm" weight="semibold">
{{ d.name }}
</Text>
<Group gap="2" align="baseline" justify="between">
<Text size="xs" class="text-muted-foreground">
{{ d.weight }}
</Text>
<Inline class="text-sm font-bold">
{{ fmtMoney(d.price, d.currency) }}
</Inline>
</Group>
</Stack>
</template>
</Stack>
</Box>
</SectionFrame>
</template>
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdnnpx ui8kit add week-menu// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* Meal delivery as a week: one column per day (its name and delivery note) with the meal of that day as a small
* card (picture, name, weight, price). Axes: media (image, none), tone.
*/
import { For, type JSX } from "solid-js";
import { Box, Group, Inline, Stack, Text } from "../compose";
import { EmptyState } from "../components/empty-state";
import { MediaFrame } from "../components/media-frame";
import { SectionFrame } from "../components/section-frame";
import { fmtMoney } from "../utils";
import type { Dish, FoodLabels } from "./dish-showcase.types";
import type { DishSection } from "./restaurant-menu.types";
export type WeekMenuProps = {
id: string;
title: string;
lead?: string;
dishes: Dish[];
sections: DishSection[];
empty?: string;
labels: FoodLabels;
media?: "image" | "none";
tone?: "default" | "muted";
landmarkLabel?: string;
};
export function WeekMenu({
id,
title,
lead = "",
dishes,
sections,
empty = "",
labels,
media = "image",
tone = "default",
landmarkLabel,
}: WeekMenuProps) {
return (
<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>
{((sections?.length ?? 0) === 0) ? (
<EmptyState icon="calendar" title={empty} />
) : (
<Box class="grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5" data-slot="items">
<For each={sections ?? []}>{(s) => (
<Stack gap="2" class="border-t-2 border-primary pt-4" data-slot="day">
<Text size="sm" weight="semibold">
{s.title}
</Text>
<Text size="xs" class="text-muted-foreground">
{s.note}
</Text>
<For each={dishes ?? []}>{(d) => (
<>
{(d.tag === s.key) ? (
<Stack gap="2" class="rounded bg-card inset-ring inset-ring-border p-4" data-slot="item">
{((media as string) === "image") ? (
<MediaFrame alt={d.name} src={d.image} ratio="4/3" />
) : null}
<Text size="sm" weight="semibold">
{d.name}
</Text>
<Group gap="2" align="baseline" justify="between">
<Text size="xs" class="text-muted-foreground">
{d.weight}
</Text>
<Inline class="text-sm font-bold">
{fmtMoney(d.price, d.currency)}
</Inline>
</Group>
</Stack>
) : null}
</>
)}</For>
</Stack>
)}</For>
</Box>
)}
</SectionFrame>
);
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdnnpx ui8kit add week-menu// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/organisms/week-menu.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// WeekMenuProps are the props of WeekMenu; the values are the JSON shapes of the TypeScript props.
type WeekMenuProps struct {
Id any `json:"id"`
Title any `json:"title"`
Lead any `json:"lead"`
Dishes any `json:"dishes"`
Sections any `json:"sections"`
Empty any `json:"empty"`
Labels any `json:"labels"`
Media any `json:"media"`
Tone any `json:"tone"`
LandmarkLabel any `json:"landmarkLabel"`
}
// Meal delivery as a week: one column per day (its name and delivery note) with the meal of that day as a small card (picture, name, weight, price). Axes: media (image, none), tone.
templ WeekMenu(p WeekMenuProps) {
{{ vId := p.Id }}
{{ vTitle := p.Title }}
{{ vLead := uiutils.Def(p.Lead, "") }}
{{ vDishes := p.Dishes }}
{{ vSections := p.Sections }}
{{ vEmpty := uiutils.Def(p.Empty, "") }}
{{ vMedia := uiutils.Def(p.Media, "image") }}
{{ vTone := uiutils.Def(p.Tone, "default") }}
{{ vLandmarkLabel := p.LandmarkLabel }}
@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Lead: vLead, Tone: vTone, LandmarkLabel: vLandmarkLabel}) {
if uiutils.Eq(uiutils.Len(vSections), float64(0)) {
@EmptyState(EmptyStateProps{Icon: "calendar", Title: vEmpty})
} else {
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5", Attrs: uiutils.Attrs("data-slot", "items")}}) {
for _, vS := range uiutils.L(vSections) {
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Class: "border-t-2 border-primary pt-4", Attrs: uiutils.Attrs("data-slot", "day")}}) {
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vS, "title")) }
}
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vS, "note")) }
}
for _, vD := range uiutils.L(vDishes) {
if uiutils.T(uiutils.Eq(uiutils.Get(vD, "tag"), uiutils.Get(vS, "key"))) {
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Class: "rounded bg-card inset-ring inset-ring-border p-4", Attrs: uiutils.Attrs("data-slot", "item")}}) {
if uiutils.Eq(vMedia, "image") {
@MediaFrame(MediaFrameProps{Alt: uiutils.Get(vD, "name"), Src: uiutils.Get(vD, "image"), Ratio: "4/3"})
}
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vD, "name")) }
}
@compose.Group(compose.GroupProps{Gap: "2", Align: "baseline", Justify: "between", BoxProps: box.BoxProps{}}) {
@compose.Text(compose.TextProps{Size: "xs", TextProps: text.TextProps{Class: "text-muted-foreground"}}) {
{ uiutils.Text(uiutils.Get(vD, "weight")) }
}
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-sm font-bold"}}) {
{ uiutils.Text(uiutils.Money(uiutils.Get(vD, "price"), uiutils.Get(vD, "currency"))) }
}
}
}
}
}
}
}
}
}
}
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdnnpx ui8kit add week-menu{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/organisms/week-menu.json
Meal delivery as a week: one column per day (its name and delivery note) with the meal of that day as a small card (picture, name, weight, price). Axes: media (image, none), tone.
Props (p): id, title, lead, dishes, sections, empty, labels, media, tone, landmarkLabel. -#}
{%- set v_id = (p.id ?? null) -%}
{%- set v_title = (p.title ?? null) -%}
{%- set v_lead = (p.lead ?? '') -%}
{%- set v_dishes = (p.dishes ?? null) -%}
{%- set v_sections = (p.sections ?? null) -%}
{%- set v_empty = (p.empty ?? '') -%}
{%- set v_media = (p.media ?? 'image') -%}
{%- set v_tone = (p.tone ?? 'default') -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_10 -%}
{%- if og_t(og_eq(og_len(v_sections), 0)) %}
{{ include('blocks/empty-state.html.twig', {'p': {'icon': 'calendar', 'title': v_empty}}, with_context = false) }}
{%- else %}
{%- set c_9 -%}
{%- for v_s in og_l(v_sections) %}
{%- set c_8 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_s, ['title'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_text(og_get(v_s, ['note'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_2}, with_context = false) }}
{%- for v_d in og_l(v_dishes) %}
{%- if og_t(og_eq(og_get(v_d, ['tag']), og_get(v_s, ['key']))) %}
{%- set c_7 -%}
{%- if og_t(og_eq(v_media, 'image')) %}
{{ include('blocks/media-frame.html.twig', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image']), 'ratio': '4/3'}}, with_context = false) }}
{%- endif %}
{%- set c_3 -%}
{{ og_text(og_get(v_d, ['name'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_3}, with_context = false) }}
{%- set c_6 -%}
{%- set c_4 -%}
{{ og_text(og_get(v_d, ['weight'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'xs', 'class': 'text-muted-foreground', 'children': c_4}, with_context = false) }}
{%- set c_5 -%}
{{ og_text(og_money(og_get(v_d, ['price']), og_get(v_d, ['currency']))) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-sm font-bold', 'children': c_5}, with_context = false) }}
{%- endset -%}
{{ include('compose/Group.html.twig', {'gap': '2', 'align': 'baseline', 'justify': 'between', 'children': c_6}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'class': 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs': og_attrs(['data-slot', 'item']), 'children': c_7}, with_context = false) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'class': 'border-t-2 border-primary pt-4', 'attrs': og_attrs(['data-slot', 'day']), 'children': c_8}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5', 'attrs': og_attrs(['data-slot', 'items']), 'children': c_9}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('blocks/section-frame.html.twig', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_10)}, with_context = false) }}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdnnpx ui8kit add week-menu{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/organisms/week-menu.json
Meal delivery as a week: one column per day (its name and delivery note) with the meal of that day as a small card (picture, name, weight, price). Axes: media (image, none), tone.
Props (p): id, title, lead, dishes, sections, empty, labels, media, tone, landmarkLabel. *}
{var $v_id = ($p['id'] ?? null)}
{var $v_title = ($p['title'] ?? null)}
{var $v_lead = ($p['lead'] ?? '')}
{var $v_dishes = ($p['dishes'] ?? null)}
{var $v_sections = ($p['sections'] ?? null)}
{var $v_empty = ($p['empty'] ?? '')}
{var $v_media = ($p['media'] ?? 'image')}
{var $v_tone = ($p['tone'] ?? 'default')}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_10}
{if og_t(og_eq(og_len($v_sections), 0))}
{=og_include('blocks/empty-state.latte', ['p' => ['icon' => 'calendar', 'title' => $v_empty]])|noescape}
{else}
{capture $c_9}
{foreach og_l($v_sections) as $v_s}
{capture $c_8}
{capture $c_1}
{=og_text(og_get($v_s, ['title']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_text(og_get($v_s, ['note']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_2])|noescape}
{foreach og_l($v_dishes) as $v_d}
{if og_t(og_eq(og_get($v_d, ['tag']), og_get($v_s, ['key'])))}
{capture $c_7}
{if og_t(og_eq($v_media, 'image'))}
{=og_include('blocks/media-frame.latte', ['p' => ['alt' => og_get($v_d, ['name']), 'src' => og_get($v_d, ['image']), 'ratio' => '4/3']])|noescape}
{/if}
{capture $c_3}
{=og_text(og_get($v_d, ['name']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_3])|noescape}
{capture $c_6}
{capture $c_4}
{=og_text(og_get($v_d, ['weight']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'xs', 'class' => 'text-muted-foreground', 'children' => (string) $c_4])|noescape}
{capture $c_5}
{=og_text(og_money(og_get($v_d, ['price']), og_get($v_d, ['currency'])))}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-sm font-bold', 'children' => (string) $c_5])|noescape}
{/capture}
{=og_include('compose/Group.latte', ['gap' => '2', 'align' => 'baseline', 'justify' => 'between', 'children' => (string) $c_6])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'class' => 'rounded bg-card inset-ring inset-ring-border p-4', 'attrs' => og_attrs(['data-slot', 'item']), 'children' => (string) $c_7])|noescape}
{/if}
{/foreach}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'class' => 'border-t-2 border-primary pt-4', 'attrs' => og_attrs(['data-slot', 'day']), 'children' => (string) $c_8])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5', 'attrs' => og_attrs(['data-slot', 'items']), 'children' => (string) $c_9])|noescape}
{/if}
{/capture}
{=og_include('blocks/section-frame.latte', ['p' => ['id' => $v_id, 'title' => $v_title, 'lead' => $v_lead, 'tone' => $v_tone, 'landmarkLabel' => $v_landmarkLabel], 'children' => og_markup($c_10)])|noescape}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdnnpx ui8kit add week-menu{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/organisms/week-menu.json
Meal delivery as a week: one column per day (its name and delivery note) with the meal of that day as a small card (picture, name, weight, price). Axes: media (image, none), tone.
Props (p): id, title, lead, dishes, sections, empty, labels, media, tone, landmarkLabel. -#}
{%- set v_id = og_def(p['id'], none) -%}
{%- set v_title = og_def(p['title'], none) -%}
{%- set v_lead = og_def(p['lead'], '') -%}
{%- set v_dishes = og_def(p['dishes'], none) -%}
{%- set v_sections = og_def(p['sections'], none) -%}
{%- set v_empty = og_def(p['empty'], '') -%}
{%- set v_media = og_def(p['media'], 'image') -%}
{%- set v_tone = og_def(p['tone'], 'default') -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_10 -%}
{%- if og_t(og_eq(og_len(v_sections), 0)) %}
{{ og_include('blocks/empty-state.html.j2', {'p': {'icon': 'calendar', 'title': v_empty}}) }}
{%- else %}
{%- set c_9 -%}
{%- for v_s in og_l(v_sections) %}
{%- set c_8 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_s, ['title'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_text(og_get(v_s, ['note'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_2}) }}
{%- for v_d in og_l(v_dishes) %}
{%- if og_t(og_eq(og_get(v_d, ['tag']), og_get(v_s, ['key']))) %}
{%- set c_7 -%}
{%- if og_t(og_eq(v_media, 'image')) %}
{{ og_include('blocks/media-frame.html.j2', {'p': {'alt': og_get(v_d, ['name']), 'src': og_get(v_d, ['image']), 'ratio': '4/3'}}) }}
{%- endif %}
{%- set c_3 -%}
{{ og_text(og_get(v_d, ['name'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_3}) }}
{%- set c_6 -%}
{%- set c_4 -%}
{{ og_text(og_get(v_d, ['weight'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'xs', 'Class': 'text-muted-foreground'}, 'children': c_4}) }}
{%- set c_5 -%}
{{ og_text(og_money(og_get(v_d, ['price']), og_get(v_d, ['currency']))) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-sm font-bold'}, 'children': c_5}) }}
{%- endset -%}
{{ og_include('compose/group.html.j2', {'p': {'Gap': '2', 'Align': 'baseline', 'Justify': 'between'}, 'children': c_6}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Class': 'rounded bg-card inset-ring inset-ring-border p-4', 'Attrs': og_attrs(['data-slot', 'item'])}, 'children': c_7}) }}
{%- endif %}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Class': 'border-t-2 border-primary pt-4', 'Attrs': og_attrs(['data-slot', 'day'])}, 'children': c_8}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-5', 'Attrs': og_attrs(['data-slot', 'items'])}, 'children': c_9}) }}
{%- endif %}
{%- endset -%}
{{ og_include('blocks/section-frame.html.j2', {'p': {'id': v_id, 'title': v_title, 'lead': v_lead, 'tone': v_tone, 'landmarkLabel': v_landmarkLabel}, 'children': og_markup(c_10)}) }}
Props
Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.
Meal delivery as a week: one column per day (its name and delivery note) with the meal of that day as a small card (picture, name, weight, price). Axes: media (image, none), tone.
| Prop | Type | Default | Description |
|---|---|---|---|
| id (required) | string | - | |
| title (required) | string | - | |
| lead | string | "" | |
| dishes (required) | Dish[] | - | |
| sections (required) | DishSection[] | - | |
| empty | string | "" | the text of the empty state (no records), from the dictionary |
| labels (required) | FoodLabels | - | |
| media | "image" | "none" | "image" | |
| tone | "default" | "muted" | "default" | |
| landmarkLabel | string | - | accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one |