mirror of https://github.com/openclaw/openclaw.git
refactor(line): share flex footer helper
This commit is contained in:
parent
a1fc6a6ea6
commit
9f84afc992
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue