Skip to content

Commit 9722431

Browse files
Copilothotlong
andcommitted
fix: extract DEFAULT_RELATED_PAGE_SIZE constant, add aria-label to count Badge
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 3930eef commit 9722431

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

packages/plugin-detail/src/DetailView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ import { buildExpandFields } from '@object-ui/core';
5353
import type { DetailViewSchema, DataSource } from '@object-ui/types';
5454
import { useDetailTranslation } from './useDetailTranslation';
5555

56+
/** Default page size for related lists in the detail view */
57+
const DEFAULT_RELATED_PAGE_SIZE = 5;
58+
5659
export interface DetailViewProps {
5760
schema: DetailViewSchema;
5861
dataSource?: DataSource;
@@ -695,7 +698,7 @@ export const DetailView: React.FC<DetailViewProps> = ({
695698
dataSource={dataSource}
696699
objectName={related.api}
697700
collapsible
698-
pageSize={5}
701+
pageSize={DEFAULT_RELATED_PAGE_SIZE}
699702
/>
700703
))}
701704
</div>
@@ -780,7 +783,7 @@ export const DetailView: React.FC<DetailViewProps> = ({
780783
dataSource={dataSource}
781784
objectName={related.api}
782785
collapsible
783-
pageSize={5}
786+
pageSize={DEFAULT_RELATED_PAGE_SIZE}
784787
/>
785788
))}
786789
</div>

packages/plugin-detail/src/RelatedList.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export const RelatedList: React.FC<RelatedListProps> = ({
270270
: (<ChevronDown className="h-4 w-4 text-muted-foreground" />)
271271
)}
272272
<span>{title}</span>
273-
<Badge variant="secondary" className="text-xs font-normal">
273+
<Badge variant="secondary" className="text-xs font-normal" aria-label={`${relatedData.length} records`}>
274274
{relatedData.length}
275275
</Badge>
276276
</div>

0 commit comments

Comments
 (0)