Skip to content

Commit

Permalink
Added component VerificationBadge and used it on GroupCard.
Browse files Browse the repository at this point in the history
Signed-off-by: Jan Hendrik Scheufen <j.h.scheufen@gmail.com>
  • Loading branch information
j-h-scheufen committed Oct 20, 2024
1 parent fb3b70a commit 4b760f6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
7 changes: 4 additions & 3 deletions packages/quilombo/components/GroupCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ReactNode } from 'react';
import { PATHS } from '@/config/constants';
import { Group } from '@/types/model';
import { getImageUrl } from '@/utils';
import VerificationChip from './VerificationChip';
import VerificationBadge from './VerificationBadge';

type Props = { group: Group; className?: string; cardFooter?: ReactNode };

Expand All @@ -17,7 +17,9 @@ const GroupCard = ({ group, className = '', cardFooter = null }: Props) => {
return (
<Card as={Link} href={`${PATHS.groups}/${id}`}>
<CardBody className={clsx('flex flex-row gap-3 p-2', className)}>
<Avatar src={getImageUrl(logo)} size="lg" />
<VerificationBadge verified={verified}>
<Avatar src={getImageUrl(logo)} size="lg" />
</VerificationBadge>
<div className="flex-1 flex flex-col">
<h3 className="flex items-center text-md">{name}</h3>
{countryName && (
Expand All @@ -28,7 +30,6 @@ const GroupCard = ({ group, className = '', cardFooter = null }: Props) => {
</span>
</div>
)}
<VerificationChip verified={verified} className="self-end" />
</div>
</CardBody>
{cardFooter && <CardFooter className="flex-row">{cardFooter}</CardFooter>}
Expand Down
27 changes: 27 additions & 0 deletions packages/quilombo/components/VerificationBadge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { Badge, BadgeProps } from '@nextui-org/badge';
import { Tooltip } from '@nextui-org/tooltip';
import { CircleCheckIcon } from 'lucide-react';

type Props = { verified: boolean } & BadgeProps;

const VerificationBadge = ({ verified, children, ...props }: Props) => {
if (!verified) return children;
return (
<Badge
content={
<Tooltip content="Verified Group">
<CircleCheckIcon className="[&>circle]:fill-primary stroke-default-100" />
</Tooltip>
}
placement="top-left"
isOneChar
color="primary"
tooltip="Verified Group"
{...props}
>
{children}
</Badge>
);
};

export default VerificationBadge;
1 change: 1 addition & 0 deletions packages/quilombo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@nextui-org/accordion": "^2.0.40",
"@nextui-org/autocomplete": "^2.1.7",
"@nextui-org/avatar": "^2.0.33",
"@nextui-org/badge": "^2.0.32",
"@nextui-org/breadcrumbs": "^2.0.13",
"@nextui-org/button": "2.0.38",
"@nextui-org/card": "^2.0.34",
Expand Down
2 changes: 1 addition & 1 deletion packages/quilombo/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ module.exports = withTV({
foreground: '#000000',
},
secondary: {
DEFAULT: '##D4A373',
DEFAULT: '#D4A373',
50: '#15100b',
100: '#2a2117',
200: '#55412e',
Expand Down
3 changes: 2 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3493,7 +3493,7 @@ __metadata:
languageName: node
linkType: hard

"@nextui-org/badge@npm:2.0.32":
"@nextui-org/badge@npm:2.0.32, @nextui-org/badge@npm:^2.0.32":
version: 2.0.32
resolution: "@nextui-org/badge@npm:2.0.32"
dependencies:
Expand Down Expand Up @@ -17101,6 +17101,7 @@ __metadata:
"@nextui-org/accordion": "npm:^2.0.40"
"@nextui-org/autocomplete": "npm:^2.1.7"
"@nextui-org/avatar": "npm:^2.0.33"
"@nextui-org/badge": "npm:^2.0.32"
"@nextui-org/breadcrumbs": "npm:^2.0.13"
"@nextui-org/button": "npm:2.0.38"
"@nextui-org/card": "npm:^2.0.34"
Expand Down

0 comments on commit 4b760f6

Please sign in to comment.