Skip to content

Commit

Permalink
feat: badge
Browse files Browse the repository at this point in the history
  • Loading branch information
rockcookies committed May 25, 2023
1 parent 7ae694d commit fcc1eac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ exports[`<Badge/> should render children correctly 1`] = `
children
<span
class="fnx-badge fnx-badge--top-right fnx-badge--fixed"
>
8
</span>
/>
</div>
</div>
`;
Expand All @@ -86,9 +84,7 @@ exports[`<Badge/> should render default count when children is not exist 1`] = `
<div>
<span
class="fnx-badge fnx-badge--top-right"
>
8
</span>
/>
</div>
`;

Expand Down
6 changes: 2 additions & 4 deletions packages/fnx-ui/src/badge/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ const NS = 'fnx-badge';
const bem = createBEM(NS);

const useProps = configComponentProps<
Required<Pick<BadgeProps, 'showZero' | 'max' | 'count' | 'position'>>
Required<Pick<BadgeProps, 'showZero' | 'max' | 'position'>>
>({
showZero: true,
max: 99,
count: 8,
position: 'top-right',
});

Expand All @@ -20,12 +19,11 @@ const Badge: React.FC<BadgeProps> = (_props) => {
{
showZero,
max,
count,
position,

...restProps
},
{ color, dot, offset, className, children, style },
{ color, dot, count, offset, className, children, style },
] = useProps(_props);

const renderCount = () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/fnx-ui/src/badge/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface BadgeComponentProps {
count?: ReactNode;
showZero?: boolean;
dot?: boolean;
max?: string | number;
max?: number;
color?: string;
offset?: [number | string, number | string];
position?: BadgePosition;
Expand Down

0 comments on commit fcc1eac

Please sign in to comment.