Skip to content

Commit

Permalink
Merge pull request #65 from getpingback/fix/add-badge-size
Browse files Browse the repository at this point in the history
Fix/add badge size
  • Loading branch information
roger067 authored Feb 21, 2025
2 parents 6d9e238 + 631ec0d commit ac92f9c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.0.341](https://github.com/getpingback/ui/compare/v0.0.340...v0.0.341) (2025-02-19)


### Bug Fixes

* add size props to badge component ([cc5fe2b](https://github.com/getpingback/ui/commits/cc5fe2b5237552f85d518228aa5e8e0ddbf6f008))

### [0.0.338](https://github.com/getpingback/ui/compare/v0.0.337...v0.0.338) (2025-02-10)


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@getpingback/ui",
"author": "Pingback Team",
"version": "0.0.340",
"version": "0.0.342",
"license": "MIT",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
14 changes: 10 additions & 4 deletions src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { cva, type VariantProps } from 'class-variance-authority';

import { cn } from '@/lib/utils';

const badgeVariants = cva('inline-flex items-center px-2.5 py-0.5 text-xs font-semibold w-fit', {
const badgeVariants = cva('inline-flex items-center px-2.5 py-0.5 font-semibold w-fit', {
variants: {
type: {
green: 'bg-badge-green text-badge-green-foreground',
Expand All @@ -24,8 +24,13 @@ const badgeVariants = cva('inline-flex items-center px-2.5 py-0.5 text-xs font-s
},
transform: {
uppercase: 'uppercase'
},
size: {
default: 'text-xs',
small: 'text-[10px] max-h-[20px]'
}
},

compoundVariants: [
{
variant: 'outline',
Expand Down Expand Up @@ -61,14 +66,15 @@ const badgeVariants = cva('inline-flex items-center px-2.5 py-0.5 text-xs font-s
defaultVariants: {
type: 'purple',
radius: 'full',
variant: 'ghost'
variant: 'ghost',
size: 'default'
}
});

export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {}

function Badge({ className, variant, type, radius, transform, ...props }: BadgeProps) {
return <div className={cn(badgeVariants({ variant, type, radius, transform }), className)} {...props} />;
function Badge({ className, variant, type, radius, transform, size, ...props }: BadgeProps) {
return <div className={cn(badgeVariants({ variant, type, radius, transform, size }), className)} {...props} />;
}

export { Badge, badgeVariants };

0 comments on commit ac92f9c

Please sign in to comment.