Allow addressing posts to lists

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-09-03 15:18:58 +02:00
parent f3ec08777c
commit 4841c5b0a2
8 changed files with 168 additions and 59 deletions

View File

@@ -1,3 +1,4 @@
import clsx from 'clsx';
import React from 'react';
import Counter from '../counter/counter';
@@ -7,6 +8,8 @@ import SvgIcon from './svg-icon';
interface IIcon extends Pick<React.SVGAttributes<SVGAElement>, 'strokeWidth'> {
/** Class name for the <svg> element. */
className?: string;
/** Class name for the <div> element. */
containerClassName?: string;
/** Number to display a counter over the icon. */
count?: number;
/** Optional max to cap count (ie: N+) */
@@ -22,9 +25,9 @@ interface IIcon extends Pick<React.SVGAttributes<SVGAElement>, 'strokeWidth'> {
}
/** Renders and SVG icon with optional counter. */
const Icon: React.FC<IIcon> = ({ src, alt, count, size, countMax, ...filteredProps }): JSX.Element => (
const Icon: React.FC<IIcon> = ({ src, alt, count, size, countMax, containerClassName, ...filteredProps }): JSX.Element => (
<div
className='relative flex shrink-0 flex-col'
className={clsx('relative flex shrink-0 flex-col', containerClassName)}
data-testid={filteredProps['data-testid'] || 'icon'}
>
{count ? (