feat(reviews): add reviews route
allows seeing all reviews with optional filters. works sans JS as well closes https://github.com/zyachel/libremdb/issues/25 closes https://codeberg.org/zyachel/libremdb/issues/19
This commit is contained in:
@@ -1,19 +1,28 @@
|
||||
import { ComponentPropsWithoutRef, ReactNode } from 'react';
|
||||
import { ComponentPropsWithoutRef, ElementType, ReactNode } from 'react';
|
||||
import Link from 'next/link';
|
||||
import Image from 'next/future/image';
|
||||
import Card from './Card';
|
||||
import { modifyIMDbImg } from 'src/utils/helpers';
|
||||
import styles from 'src/styles/modules/components/card/card-result.module.scss';
|
||||
|
||||
type Props = {
|
||||
type Props<T extends ElementType> = {
|
||||
link: string;
|
||||
name: string;
|
||||
image?: string;
|
||||
showImage?: true;
|
||||
children?: ReactNode;
|
||||
} & ComponentPropsWithoutRef<'li'>;
|
||||
as?: T;
|
||||
} & ComponentPropsWithoutRef<T>;
|
||||
|
||||
const CardResult = ({ link, name, image, showImage, children, ...rest }: Props) => {
|
||||
const CardResult = <T extends 'li' | 'section' | 'div' = 'li'>({
|
||||
link,
|
||||
name,
|
||||
image,
|
||||
showImage,
|
||||
className,
|
||||
children,
|
||||
...rest
|
||||
}: Props<T>) => {
|
||||
let ImageComponent = null;
|
||||
if (showImage)
|
||||
ImageComponent = image ? (
|
||||
@@ -25,7 +34,11 @@ const CardResult = ({ link, name, image, showImage, children, ...rest }: Props)
|
||||
);
|
||||
|
||||
return (
|
||||
<Card hoverable {...rest} className={`${styles.item} ${!showImage && styles.sansImage}`}>
|
||||
<Card
|
||||
hoverable
|
||||
{...rest}
|
||||
className={`${styles.item} ${!showImage && styles.sansImage} ${className}`}
|
||||
>
|
||||
<div className={styles.imgContainer}>{ImageComponent}</div>
|
||||
<div className={styles.info}>
|
||||
<Link href={link}>
|
||||
|
Reference in New Issue
Block a user