From 6e94f13742b3db25486f577803472f6f373348f3 Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Mon, 15 Jun 2020 21:29:47 -0700 Subject: [PATCH] feat: Smarter line break opportunities for default values --- src/components/PropList.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/PropList.js b/src/components/PropList.js index 53df022b6..2516310eb 100644 --- a/src/components/PropList.js +++ b/src/components/PropList.js @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { Fragment } from 'react'; import cx from 'classnames'; import PropTypes from 'prop-types'; import CodeDef from './CodeDef'; @@ -106,7 +106,20 @@ const PropList = ({ propTypes }) => { {defaultValue !== undefined && (
DEFAULT
- {String(defaultValue)} + + {String(defaultValue) + .split('.') + .map((word, idx, parts) => ( + + {word} + {idx !== parts.length - 1 && ( + <> + . + + )} + + ))} +
)}