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
922 B
TypeScript

import { Problem as ProblemModel } from '../../shared/model'
import { prependBaseUrl } from '../api'
import { Markdown } from './Markdown'
2 years ago
type Props = {
id: string
title: string
content: string
solutionsCount?: number
}
export const Problem = ({ id, title, content, solutionsCount }: Props) => {
2 years ago
return (
<div class="problem">
<div class="problem-header">
<div class="problem-title">
<a href={prependBaseUrl(`/problem/${id}`)}>{title}</a>
2 years ago
</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>
)}
2 years ago
</div>
)
}