mirror of
https://github.com/Redocly/redoc.git
synced 2025-11-03 17:27:31 +03:00
23 lines
566 B
TypeScript
23 lines
566 B
TypeScript
import * as React from 'react';
|
|
import { ConstraintItem } from '../../common-elements/fields';
|
|
|
|
export interface ConstraintsViewProps {
|
|
constraints: string[];
|
|
}
|
|
|
|
export class ConstraintsView extends React.PureComponent<ConstraintsViewProps> {
|
|
render() {
|
|
if (this.props.constraints.length === 0) {
|
|
return null;
|
|
}
|
|
return (
|
|
<span className="field-constraints">
|
|
{' '}
|
|
{this.props.constraints.map(constraint => (
|
|
<ConstraintItem key={constraint}> {constraint} </ConstraintItem>
|
|
))}
|
|
</span>
|
|
);
|
|
}
|
|
}
|