From 2ede22c45cc970ea1ac296adbae1f6032744f823 Mon Sep 17 00:00:00 2001 From: Anna Stasiuk Date: Tue, 9 Jun 2020 13:36:43 +0300 Subject: [PATCH] fix: do not display long regexps (#1295) --- src/components/Fields/FieldDetails.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Fields/FieldDetails.tsx b/src/components/Fields/FieldDetails.tsx index ed9a48dd..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,9 @@ export class FieldDetails extends React.PureComponent { {schema.title && !hideSchemaTitles && ({schema.title}) } {schema.nullable && {l('nullable')} } - {schema.pattern && {schema.pattern} } + {schema.pattern && schema.pattern.length < MAX_PATTERN_LENGTH && ( + {schema.pattern} + )} {schema.isCircular && {l('recursive')} } {deprecated && (