From d394cd5439c89dafdac43606fc7eed77011d3a4e Mon Sep 17 00:00:00 2001 From: Anya Stasiuk Date: Tue, 9 Jun 2020 13:28:46 +0300 Subject: [PATCH] refactor: move max pattern length value to constant --- src/components/Fields/FieldDetails.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Fields/FieldDetails.tsx b/src/components/Fields/FieldDetails.tsx index 6055b7ff..8c67c513 100644 --- a/src/components/Fields/FieldDetails.tsx +++ b/src/components/Fields/FieldDetails.tsx @@ -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 { static contextType = OptionsContext; render() { @@ -62,7 +64,7 @@ export class FieldDetails extends React.PureComponent { {schema.title && !hideSchemaTitles && ({schema.title}) } {schema.nullable && {l('nullable')} } - {schema.pattern && schema.pattern.length < 45 && ( + {schema.pattern && schema.pattern.length < MAX_PATTERN_LENGTH && ( {schema.pattern} )} {schema.isCircular && {l('recursive')} }