refactor(line): dedupe schedule card header

This commit is contained in:
Peter Steinberger
2026-02-15 16:39:45 +00:00
parent 3a3bfa7f13
commit dda3026d13

View File

@@ -28,6 +28,21 @@ function buildTitleSubtitleHeader(params: { title: string; subtitle?: string }):
return headerContents;
}
function buildCardHeaderSections(headerContents: FlexComponent[]): FlexComponent[] {
return [
{
type: "box",
layout: "vertical",
contents: headerContents,
paddingBottom: "lg",
} as FlexBox,
{
type: "separator",
color: "#EEEEEE",
},
];
}
function createMegaBubbleWithFooter(params: {
bodyContents: FlexComponent[];
footer?: string;
@@ -101,16 +116,7 @@ export function createReceiptCard(params: {
const headerContents = buildTitleSubtitleHeader({ title, subtitle });
const bodyContents: FlexComponent[] = [
{
type: "box",
layout: "vertical",
contents: headerContents,
paddingBottom: "lg",
} as FlexBox,
{
type: "separator",
color: "#EEEEEE",
},
...buildCardHeaderSections(headerContents),
{
type: "box",
layout: "vertical",
@@ -448,16 +454,7 @@ export function createAgendaCard(params: {
});
const bodyContents: FlexComponent[] = [
{
type: "box",
layout: "vertical",
contents: headerContents,
paddingBottom: "lg",
} as FlexBox,
{
type: "separator",
color: "#EEEEEE",
},
...buildCardHeaderSections(headerContents),
{
type: "box",
layout: "vertical",