2023-03-03 18:26:26 +00:00
|
|
|
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
|
|
|
|
|
2023-05-01 18:32:32 +00:00
|
|
|
// eslint-disable-next-line unicorn/consistent-function-scoping
|
2023-03-03 18:26:26 +00:00
|
|
|
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)}
|
|
|
|
>
|
|
|
|
−
|
|
|
|
</button>
|
|
|
|
{/*TODO*/}
|
|
|
|
<span class={styles.ratingValue}>{123}</span>
|
|
|
|
<button
|
|
|
|
class={clsx(styles.ratingControl, styles.upvoteButton)}
|
|
|
|
onClick={() => handleRatingChange(true)}
|
|
|
|
>
|
|
|
|
+
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|