Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update - Melhoria na listagem de suplementos #249

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 23 additions & 14 deletions src/components/Chip/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,32 @@ import { cva } from 'class-variance-authority';
const Chip = React.forwardRef<HTMLDivElement, IChipProps>((props, ref) => {
const { label, className, variant = 'info', ...rest } = props;

const variants = cva('px-4 py-1.5 font-medium text-sm md:text-md rounded-2xl', {
variants: {
variant: {
warn: 'bg-light-yellow',
success: 'bg-light-green',
danger: 'bg-light-red',
alert: 'bg-light-orange',
info: 'bg-light-blue',
const variants = cva(
'px-4 py-1.5 font-medium text-sm md:text-md rounded-2xl',
{
variants: {
variant: {
warn: 'bg-light-yellow',
success: 'bg-light-green',
danger: 'bg-light-red',
alert: 'bg-light-orange',
info: 'bg-light-blue',
moreInfo: 'bg-gray-200 text-black-600',
},
},
},
defaultVariants: {
variant: 'info',
},
});
defaultVariants: {
variant: 'info',
},
}
);

return (
<span tabIndex={0} ref={ref} {...rest} className={variants({ className, variant })}>
<span
tabIndex={0}
ref={ref}
{...rest}
className={variants({ className, variant })}
>
{label}
</span>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Chip/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type ChipVariant = 'info' | 'success' | 'warn' | 'danger';
export type ChipVariant = 'info' | 'success' | 'warn' | 'danger' | 'moreInfo';

export interface IChipProps extends React.ComponentPropsWithoutRef<'div'> {
label: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ const ShelterSupplyCategoryRow = React.forwardRef<
</p>
{description && <p>{description}</p>}
<div className="flex gap-2 flex-wrap">
{tags.map((s, idx) => (
{tags.slice(0, 10).map((s, idx) => (
<Chip key={idx} {...s} />
))}

{tags.length > 10 && (
<Chip label={`+${tags.length - 10} itens`} variant="moreInfo" />
xlucaix marked this conversation as resolved.
Show resolved Hide resolved
)}
</div>
</div>
);
Expand Down