refactor(FE): Refactor PdfStatusBadge to use a single style prop

This commit is contained in:
rstubryan
2026-02-10 14:04:44 +07:00
parent 5cc51c52d9
commit 4c6ac6e8e1
3 changed files with 20 additions and 12 deletions
@@ -162,9 +162,11 @@ const getTableData = (
value: item.status ? (
<View style={{ alignItems: 'center' }}>
<PdfStatusBadge
backgroundColor={getPDFBadgeStyle(item.status, 'payment').bg}
textColor={getPDFBadgeStyle(item.status, 'payment').text}
borderColor={getPDFBadgeStyle(item.status, 'payment').border}
style={{
backgroundColor: getPDFBadgeStyle(item.status, 'payment').bg,
color: getPDFBadgeStyle(item.status, 'payment').text,
borderColor: getPDFBadgeStyle(item.status, 'payment').border,
}}
>
{formatTitleCase(item.status)}
</PdfStatusBadge>
@@ -113,9 +113,11 @@ const getTableData = (rows: DebtSupplier['rows']): PdfTbodyCell[][] => {
item.due_status && item.due_status !== '-' ? (
<View style={{ alignItems: 'center' }}>
<PdfStatusBadge
backgroundColor={getPDFBadgeStyle(item.due_status, 'due').bg}
textColor={getPDFBadgeStyle(item.due_status, 'due').text}
borderColor={getPDFBadgeStyle(item.due_status, 'due').border}
style={{
backgroundColor: getPDFBadgeStyle(item.due_status, 'due').bg,
color: getPDFBadgeStyle(item.due_status, 'due').text,
borderColor: getPDFBadgeStyle(item.due_status, 'due').border,
}}
>
{item.due_status}
</PdfStatusBadge>
@@ -148,9 +150,11 @@ const getTableData = (rows: DebtSupplier['rows']): PdfTbodyCell[][] => {
item.status && item.status !== '-' ? (
<View style={{ alignItems: 'center' }}>
<PdfStatusBadge
backgroundColor={getPDFBadgeStyle(item.status, 'payment').bg}
textColor={getPDFBadgeStyle(item.status, 'payment').text}
borderColor={getPDFBadgeStyle(item.status, 'payment').border}
style={{
backgroundColor: getPDFBadgeStyle(item.status, 'payment').bg,
color: getPDFBadgeStyle(item.status, 'payment').text,
borderColor: getPDFBadgeStyle(item.status, 'payment').border,
}}
>
{item.status}
</PdfStatusBadge>
@@ -144,9 +144,11 @@ const getTableData = (
value: item.expedition ? (
<View style={{ alignItems: 'center' }}>
<PdfStatusBadge
backgroundColor='#DBEAFE'
textColor='#1E40AF'
borderColor='#60A5FA'
style={{
backgroundColor: '#DBEAFE',
color: '#1E40AF',
borderColor: '#60A5FA',
}}
>
{item.expedition}
</PdfStatusBadge>