feat(SW-543): update footnote

This commit is contained in:
Fredrik Thorsson
2025-01-08 11:28:05 +01:00
parent 034fff59bd
commit 2f8e1b6c79
4 changed files with 7 additions and 9 deletions

View File

@@ -17,8 +17,8 @@ export default async function ContactRow({ contact }: ContactRowProps) {
}
const val = getValueFromContactConfig(contact.contact_field, data)
const footnote = contact.phoneFootnote
? getValueFromContactConfig(contact.phoneFootnote, data)
const footnote = contact.footnote
? getValueFromContactConfig(contact.footnote, data)
: null
if (!val) {
@@ -54,9 +54,7 @@ export default async function ContactRow({ contact }: ContactRowProps) {
{Icon ? <Icon width="20" height="20" color="burgundy" /> : null}
{val}
</Link>
{footnote && contact.contact_field.includes("phone") && (
<Footnote color="burgundy">{footnote}</Footnote>
)}
{footnote && <Footnote color="burgundy">{footnote}</Footnote>}
</div>
)
}

View File

@@ -13,7 +13,7 @@
fragment ContactFields on ContactFields {
display_text
contact_field
phone_footnote
footnote
}
fragment JoinLoyaltyContactSidebar_ContentPage on ContentPageSidebarJoinLoyaltyContact {

View File

@@ -77,7 +77,7 @@ export type ContactConfig = ContactConfigData["all_contact_config"]["items"][0]
export type ContactFields = {
display_text: string | null
contact_field: string
phoneFootnote?: string | null
footnote?: string | null
}
export const validateCurrentHeaderConfigSchema = z

View File

@@ -22,7 +22,7 @@ export const contactSchema = z.object({
contact: z.object({
contact_field: z.string(),
display_text: z.string().optional().nullable().default(null),
phone_footnote: z.string().optional().nullable(),
footnote: z.string().optional().nullable(),
}),
})
.transform((data) => {
@@ -31,7 +31,7 @@ export const contactSchema = z.object({
typename: data.typename,
contact_field: data.contact.contact_field,
display_text: data.contact.display_text,
phoneFootnote: data.contact.phone_footnote,
footnote: data.contact.footnote,
}
})
),