2024-06-13 16:04:12 +00:00
|
|
|
import classNames from 'classnames'
|
2024-06-17 14:47:22 +00:00
|
|
|
import Link from 'next/link'
|
2024-01-15 12:33:15 +00:00
|
|
|
import { ReactNode } from 'react'
|
2024-06-13 16:04:12 +00:00
|
|
|
import { Icon } from '../Icon'
|
2024-01-15 12:33:15 +00:00
|
|
|
|
|
|
|
export function ParametersTable({ children }: { children: ReactNode }) {
|
|
|
|
return (
|
|
|
|
<div className="article__parameters-table__wrapper">
|
|
|
|
<table className="article__parameters-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>{children}</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
export function ParametersTableRow({ children }: { children: ReactNode }) {
|
|
|
|
return <tr className="article__parameters-table__row">{children}</tr>
|
|
|
|
}
|
|
|
|
|
|
|
|
export function ParametersTableName({ children }: { children: ReactNode }) {
|
|
|
|
return <td className="article__parameters-table__name">{children}</td>
|
|
|
|
}
|
|
|
|
|
|
|
|
export function ParametersTableDescription({ children }: { children: ReactNode }) {
|
|
|
|
return <td className="article__parameters-table__description">{children}</td>
|
|
|
|
}
|
2024-06-13 16:04:12 +00:00
|
|
|
|
|
|
|
export function TitleWithSourceLink({
|
|
|
|
children,
|
|
|
|
source,
|
|
|
|
large,
|
|
|
|
tags,
|
2024-06-17 14:47:22 +00:00
|
|
|
inherited,
|
2024-06-13 16:04:12 +00:00
|
|
|
}: {
|
|
|
|
children: ReactNode
|
|
|
|
source?: string | null
|
|
|
|
large?: boolean
|
|
|
|
tags?: string[]
|
2024-06-17 14:47:22 +00:00
|
|
|
inherited?: { name: string; link: string }
|
2024-06-13 16:04:12 +00:00
|
|
|
}) {
|
|
|
|
return (
|
2024-06-17 14:47:22 +00:00
|
|
|
<>
|
|
|
|
<div
|
|
|
|
className={classNames(
|
|
|
|
'article__title-with-source-link',
|
|
|
|
large && 'article__title-with-source-link--large'
|
2024-06-13 16:04:12 +00:00
|
|
|
)}
|
2024-06-17 14:47:22 +00:00
|
|
|
>
|
|
|
|
{children}
|
|
|
|
<div className="article__title-with-source-link__meta">
|
|
|
|
{tags?.map((tag) => (
|
|
|
|
<Tag key={tag} tag={tag}>
|
|
|
|
{tag}
|
|
|
|
</Tag>
|
|
|
|
))}
|
|
|
|
{source && (
|
|
|
|
<a
|
|
|
|
href={source}
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
title="Source code"
|
|
|
|
className="article__title-with-source-link__source"
|
|
|
|
>
|
|
|
|
<Icon icon="code" />
|
|
|
|
</a>
|
|
|
|
)}
|
|
|
|
</div>
|
2024-06-13 16:04:12 +00:00
|
|
|
</div>
|
2024-06-17 14:47:22 +00:00
|
|
|
{inherited && (
|
|
|
|
<div className="article__title-with-source-link__from">
|
|
|
|
from{' '}
|
|
|
|
<code className="hljs">
|
|
|
|
<Link href={inherited.link} className="code-link">
|
|
|
|
{inherited.name}
|
|
|
|
</Link>
|
|
|
|
</code>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</>
|
2024-06-13 16:04:12 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2024-06-17 14:47:22 +00:00
|
|
|
export function Tag({ children, tag }: { children: ReactNode; tag: string }) {
|
|
|
|
return <span className={classNames(`article__tag`, `article__tag--${tag}`)}>{children}</span>
|
2024-06-13 16:04:12 +00:00
|
|
|
}
|