1
0
mirror of synced 2025-12-21 02:46:50 -05:00
Files
docs/components/rest/RestMethod.tsx
2022-05-02 10:10:33 -07:00

23 lines
748 B
TypeScript

import cx from 'classnames'
import styles from './RestCodeSamples.module.scss'
type RestMethodT = {
verb: string
requestPath: string
}
export function RestMethod({ verb, requestPath }: RestMethodT) {
// If the path is long, we want to break it up into multiple lines,
// breaking before the / character.
const displayPath = requestPath.length > 25 ? requestPath.replaceAll('/', '<wbr/>/') : requestPath
return (
<div className={cx(styles.method, 'my-0 text-mono d-flex flex-row flex-items-start ')}>
<span className="IssueLabel IssueLabel--big color-bg-accent-emphasis color-fg-on-emphasis text-uppercase mr-2">
{verb}
</span>
<span dangerouslySetInnerHTML={{ __html: displayPath }} />
</div>
)
}