Skip to content

Commit

Permalink
feat: Smarter line break opportunities for default values
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 16, 2020
1 parent 0aa2bb0 commit 6e94f13
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/components/PropList.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -106,7 +106,20 @@ const PropList = ({ propTypes }) => {
{defaultValue !== undefined && (
<div className={styles.default}>
<div className={styles.label}>DEFAULT</div>
<code>{String(defaultValue)}</code>
<code>
{String(defaultValue)
.split('.')
.map((word, idx, parts) => (
<Fragment key={idx}>
{word}
{idx !== parts.length - 1 && (
<>
.<wbr />
</>
)}
</Fragment>
))}
</code>
</div>
)}
</div>
Expand Down

0 comments on commit 6e94f13

Please sign in to comment.