import { MetaItemSchema } from '@interval/sdk/dist/classes/Layout'
import classNames from 'classnames'
import Skeleton from 'react-loading-skeleton'
import IVConstraintsIndicator from '~/components/IVConstraintsIndicator'
import MetadataValue from './MetadataValue'
export function MetadataCard({ item }: { item: MetaItemSchema }) {
return (
{item.label}
{item.error ? (
Error loading metadata
{item.error}}
id="admin-explanation"
placement="right"
/>
) : (
{'value' in item && item.value === undefined && !item.image?.url ? (
) : (
)}
)}
)
}
function getGridClassName(itemsCount: number) {
if (itemsCount === 2) return 'grid-cols-2'
if (itemsCount === 3) return 'sm:grid-cols-3'
if (itemsCount >= 4) return 'grid-cols-2 md:grid-cols-4'
}
export interface MetadataCardListProps {
label?: string
items: MetaItemSchema[]
}
export default function MetadataCardList({
label,
items,
}: MetadataCardListProps) {
return (
{label &&
{label}
}
{items.map((item, i) => (
))}
)
}