feat: add card ids

This commit is contained in:
Elliot DeNolf
2022-07-14 14:09:59 -07:00
parent 48700a93e3
commit baf4664073
3 changed files with 8 additions and 2 deletions

View File

@@ -7,15 +7,19 @@ import './index.scss';
const baseClass = 'card';
const Card: React.FC<Props> = (props) => {
const { title, actions, onClick } = props;
const { id, title, actions, onClick } = props;
const classes = [
baseClass,
id,
onClick && `${baseClass}--has-onclick`,
].filter(Boolean).join(' ');
return (
<div className={classes}>
<div
className={classes}
id={id}
>
<h5>
{title}
</h5>

View File

@@ -1,4 +1,5 @@
export type Props = {
id?: string,
title: string,
actions?: React.ReactNode,
onClick?: () => void,

View File

@@ -47,6 +47,7 @@ const Dashboard: React.FC<Props> = (props) => {
<li key={collection.slug}>
<Card
title={collection.labels.plural}
id={`card-${collection.slug}`}
onClick={() => push({ pathname: `${admin}/collections/${collection.slug}` })}
actions={hasCreatePermission ? (
<Button