You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
874 B
TypeScript
31 lines
874 B
TypeScript
import { prependBaseUrl } from '../../shared/utils'
|
|
|
|
import { Markdown } from './Markdown'
|
|
|
|
type Props = {
|
|
id: string
|
|
title: string
|
|
content: string
|
|
solutionsCount?: number
|
|
}
|
|
|
|
export const Problem = ({ id, title, content, solutionsCount }: Props) => {
|
|
return (
|
|
<div class="problem">
|
|
<div class="problem-header">
|
|
<div class="problem-title">
|
|
<a href={prependBaseUrl(`/problem/${id}`)}>{title}</a>
|
|
</div>
|
|
</div>
|
|
<div class="problem-content">
|
|
<Markdown source={content} />
|
|
</div>
|
|
{solutionsCount !== undefined && solutionsCount > 0 && (
|
|
<div class="problem-footer">
|
|
{solutionsCount} soluzion{solutionsCount === 1 ? 'e' : 'i'}
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|