mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
refactor(line): share flex footer helper
This commit is contained in:
@@ -10,6 +10,7 @@ import type {
|
||||
FlexText,
|
||||
ListItem,
|
||||
} from "./types.js";
|
||||
import { attachFooterText } from "./common.js";
|
||||
|
||||
/**
|
||||
* Create an info card with title, body, and optional footer
|
||||
@@ -76,22 +77,7 @@ export function createInfoCard(title: string, body: string, footer?: string): Fl
|
||||
};
|
||||
|
||||
if (footer) {
|
||||
bubble.footer = {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: footer,
|
||||
size: "xs",
|
||||
color: "#AAAAAA",
|
||||
wrap: true,
|
||||
align: "center",
|
||||
} as FlexText,
|
||||
],
|
||||
paddingAll: "lg",
|
||||
backgroundColor: "#FAFAFA",
|
||||
};
|
||||
attachFooterText(bubble, footer);
|
||||
}
|
||||
|
||||
return bubble;
|
||||
|
||||
20
src/line/flex-templates/common.ts
Normal file
20
src/line/flex-templates/common.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { FlexBox, FlexBubble, FlexText } from "./types.js";
|
||||
|
||||
export function attachFooterText(bubble: FlexBubble, footer: string) {
|
||||
bubble.footer = {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: footer,
|
||||
size: "xs",
|
||||
color: "#AAAAAA",
|
||||
wrap: true,
|
||||
align: "center",
|
||||
} as FlexText,
|
||||
],
|
||||
paddingAll: "lg",
|
||||
backgroundColor: "#FAFAFA",
|
||||
} as FlexBox;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { Action, FlexBox, FlexBubble, FlexComponent, FlexText } from "./types.js";
|
||||
import { attachFooterText } from "./common.js";
|
||||
|
||||
/**
|
||||
* Create a receipt/summary card (for orders, transactions, data tables)
|
||||
@@ -135,22 +136,7 @@ export function createReceiptCard(params: {
|
||||
};
|
||||
|
||||
if (footer) {
|
||||
bubble.footer = {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: footer,
|
||||
size: "xs",
|
||||
color: "#AAAAAA",
|
||||
wrap: true,
|
||||
align: "center",
|
||||
} as FlexText,
|
||||
],
|
||||
paddingAll: "lg",
|
||||
backgroundColor: "#FAFAFA",
|
||||
};
|
||||
attachFooterText(bubble, footer);
|
||||
}
|
||||
|
||||
return bubble;
|
||||
@@ -499,22 +485,7 @@ export function createAgendaCard(params: {
|
||||
};
|
||||
|
||||
if (footer) {
|
||||
bubble.footer = {
|
||||
type: "box",
|
||||
layout: "vertical",
|
||||
contents: [
|
||||
{
|
||||
type: "text",
|
||||
text: footer,
|
||||
size: "xs",
|
||||
color: "#AAAAAA",
|
||||
align: "center",
|
||||
wrap: true,
|
||||
} as FlexText,
|
||||
],
|
||||
paddingAll: "lg",
|
||||
backgroundColor: "#FAFAFA",
|
||||
};
|
||||
attachFooterText(bubble, footer);
|
||||
}
|
||||
|
||||
return bubble;
|
||||
|
||||
Reference in New Issue
Block a user