webapp/src/components/Author/AuthorRatingControl.tsx
bniwredyc cfb744c0a0 lint
2023-05-01 20:32:32 +02:00

43 lines
1.1 KiB
TypeScript

import styles from './AuthorRatingControl.module.scss'
import { clsx } from 'clsx'
import type { Author } from '../../graphql/types.gen'
interface AuthorRatingControlProps {
author: Author
class?: string
}
export const AuthorRatingControl = (props: AuthorRatingControlProps) => {
const isUpvoted = false
const isDownvoted = false
// eslint-disable-next-line unicorn/consistent-function-scoping
const handleRatingChange = (isUpvote: boolean) => {
console.log('handleRatingChange', { isUpvote })
}
return (
<div
class={clsx(styles.rating, props.class, {
[styles.isUpvoted]: isUpvoted,
[styles.isDownvoted]: isDownvoted
})}
>
<button
class={clsx(styles.ratingControl, styles.downvoteButton)}
onClick={() => handleRatingChange(false)}
>
&minus;
</button>
{/*TODO*/}
<span class={styles.ratingValue}>{123}</span>
<button
class={clsx(styles.ratingControl, styles.upvoteButton)}
onClick={() => handleRatingChange(true)}
>
+
</button>
</div>
)
}