refactor: move max pattern length value to constant

This commit is contained in:
Anya Stasiuk 2020-06-09 13:28:46 +03:00
parent 902b4b7a68
commit d394cd5439

View File

@ -23,6 +23,8 @@ import { Badge } from '../../common-elements/';
import { l } from '../../services/Labels';
import { OptionsContext } from '../OptionsProvider';
const MAX_PATTERN_LENGTH = 45;
export class FieldDetails extends React.PureComponent<FieldProps> {
static contextType = OptionsContext;
render() {
@ -62,7 +64,7 @@ export class FieldDetails extends React.PureComponent<FieldProps> {
{schema.title && !hideSchemaTitles && <TypeTitle> ({schema.title}) </TypeTitle>}
<ConstraintsView constraints={schema.constraints} />
{schema.nullable && <NullableLabel> {l('nullable')} </NullableLabel>}
{schema.pattern && schema.pattern.length < 45 && (
{schema.pattern && schema.pattern.length < MAX_PATTERN_LENGTH && (
<PatternLabel> {schema.pattern} </PatternLabel>
)}
{schema.isCircular && <RecursiveLabel> {l('recursive')} </RecursiveLabel>}