Skip to content

Commit

Permalink
move documents count between amount and date
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvarajsai committed Dec 2, 2024
1 parent 498337e commit 44cb800
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
20 changes: 8 additions & 12 deletions src/app/groups/[groupId]/expenses/documents-count.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@ import { useTranslations } from 'next-intl'

type DocumentCount = {
documents: ExpenseFormValues['documents']
showMidDot: Boolean
}
export function DocumentsCount({ documents, showMidDot }: DocumentCount) {
export function DocumentsCount({ documents }: DocumentCount) {
const t = useTranslations('ExpenseCard')
const documentsCount = documents.length
if (documentsCount === 0) return <></>
return (
<>
<div className="flex items-center">
<Paperclip className="w-4 h-4 mr-1 mt-0.5 text-muted-foreground" />
<span>
{documentsCount}{' '}
{documentsCount === 1 ? t('attachment') : t('attachments')}
</span>
</div>
{showMidDot ? <span>&nbsp;&middot;&nbsp;</span> : <></>}
</>
<div className="flex items-center">
<Paperclip className="w-4 h-4 mr-1 mt-0.5 text-muted-foreground" />
<span>
{documentsCount}{' '}
{documentsCount === 1 ? t('attachment') : t('attachments')}
</span>
</div>
)
}
6 changes: 4 additions & 2 deletions src/app/groups/[groupId]/expenses/expense-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ export function ExpenseCard({ expense, currency, groupId }: Props) {
>
{formatCurrency(currency, expense.amount, locale)}
</div>
<div className="flex items-center text-xs text-muted-foreground">
<DocumentsCount documents={expense.documents} showMidDot />
<div className="text-xs text-muted-foreground">
<DocumentsCount documents={expense.documents} />
</div>
<div className="text-xs text-muted-foreground">
{formatDate(expense.expenseDate, locale, { dateStyle: 'medium' })}
</div>
</div>
Expand Down

0 comments on commit 44cb800

Please sign in to comment.