diff --git a/.prettierrc.json b/.prettierrc.json
index 79e50a4981..6799f36619 100644
--- a/.prettierrc.json
+++ b/.prettierrc.json
@@ -1,5 +1,6 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
+ "htmlWhitespaceSensitivity": "ignore",
"printWidth": 100,
"tabWidth": 2,
"semi": false,
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 19d913f989..7bd68e5e0b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,6 +23,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Features
- `Ref` components uses `forwardRef` API by default @layershifter ([#491](https://github.com/stardust-ui/react/pull/491))
+### Documentation
+- Add `prettier` support throughout the docs @levithomason ([#568](https://github.com/stardust-ui/react/pull/568))
+
## [v0.14.0](https://github.com/stardust-ui/react/tree/v0.14.0) (2018-12-05)
[Compare changes](https://github.com/stardust-ui/react/compare/v0.13.3...v0.14.0)
diff --git a/docs/src/components/CodeSnippet.tsx b/docs/src/components/CodeSnippet.tsx
index aa8704ead3..357a5c3239 100644
--- a/docs/src/components/CodeSnippet.tsx
+++ b/docs/src/components/CodeSnippet.tsx
@@ -1,50 +1,66 @@
+import * as _ from 'lodash'
import * as React from 'react'
+
+import formatCode from '../utils/formatCode'
import Editor, { EDITOR_BACKGROUND_COLOR } from './Editor'
export interface CodeSnippetProps {
+ fitted?: boolean
label?: string
mode?: 'jsx' | 'html' | 'sh'
value: string
style?: React.CSSProperties
}
-const CodeSnippet = ({ label, value, mode = 'jsx', style, ...rest }: CodeSnippetProps) => (
-
+const formatters = {
+ sh: (val: string = ''): string => val.replace(/^/g, '$ '),
+ html: (val: string = ''): string => formatCode(val, 'html'),
+ jsx: (val: string = ''): string => formatCode(val, 'babylon'),
+}
+
+const CodeSnippet = ({ fitted, label, value, mode = 'jsx', ...rest }: CodeSnippetProps) => {
+ const format = formatters[mode]
+ const formattedValue = format(value)
+ // remove eof line break, they are not helpful for snippets
+ .replace(/\n$/, '')
+
+ return (
- {label || mode}
+
+ {label || mode}
+
+
-
-
-)
+ )
+}
export default CodeSnippet
diff --git a/docs/src/components/ComponentDoc/ComponentExample/ComponentExample.tsx b/docs/src/components/ComponentDoc/ComponentExample/ComponentExample.tsx
index 3c5782a653..ee42bf791a 100644
--- a/docs/src/components/ComponentDoc/ComponentExample/ComponentExample.tsx
+++ b/docs/src/components/ComponentDoc/ComponentExample/ComponentExample.tsx
@@ -2,14 +2,13 @@ import * as _ from 'lodash'
import PropTypes from 'prop-types'
import * as React from 'react'
import { RouteComponentProps, withRouter } from 'react-router'
-import { html } from 'js-beautify'
import * as copyToClipboard from 'copy-to-clipboard'
import SourceRender from 'react-source-render'
import { Divider, Form, Grid, Menu, Segment, Visibility } from 'semantic-ui-react'
import { Provider, themes } from '@stardust-ui/react'
import { examplePathToHash, getFormattedHash, knobsContext, scrollToAnchor } from 'docs/src/utils'
-import { callable, doesNodeContainClick, pxToRem, constants } from 'src/lib'
+import { callable, pxToRem, constants } from 'src/lib'
import Editor, { EDITOR_BACKGROUND_COLOR, EDITOR_GUTTER_COLOR } from 'docs/src/components/Editor'
import { babelConfig, importResolver } from 'docs/src/components/Playground/renderConfig'
import ComponentControls from '../ComponentControls'
@@ -19,6 +18,8 @@ import SourceCodeManager, { SourceCodeType } from './SourceCodeManager'
import { ThemeInput, ThemePrepared } from 'src/themes/types'
import { mergeThemeVariables } from '../../../../../src/lib/mergeThemes'
import { ThemeContext } from '../../../context/theme-context'
+import CodeSnippet from '../../CodeSnippet'
+import formatCode from '../../../utils/formatCode'
export interface ComponentExampleProps extends RouteComponentProps {
title: React.ReactNode
@@ -52,16 +53,17 @@ const codeTypeApiButtonLabels: { [key in SourceCodeType]: string } = {
shorthand: 'Shorthand API',
}
+const disabledStyle = { opacity: 0.5, pointerEvents: 'none' }
+
/**
* Renders a `component` and the raw `code` that produced it.
* Allows toggling the the raw `code` code block.
*/
class ComponentExample extends React.Component {
- private componentRef: React.Component
- private sourceCodeMgr: SourceCodeManager
- private anchorName: string
- private kebabExamplePath: string
- private KnobsComponent: any
+ sourceCodeMgr: SourceCodeManager
+ anchorName: string
+ kebabExamplePath: string
+ KnobsComponent: any
state = {
knobs: {},
@@ -78,11 +80,11 @@ class ComponentExample extends React.Component {
+ clearActiveState = () => {
this.setState({
showCode: false,
showRtl: false,
@@ -129,31 +131,27 @@ class ComponentExample extends React.Component {
+ isActiveState = () => {
const { showCode, showVariables } = this.state
return showCode || showVariables
}
- private isActiveHash = () => this.anchorName === getFormattedHash(this.props.location.hash)
-
- private clickedOutsideComponent = (e: Event): boolean => {
- return !doesNodeContainClick((this.componentRef as any).ref, e)
- }
+ isActiveHash = () => this.anchorName === getFormattedHash(this.props.location.hash)
- private updateHash = () => {
+ updateHash = () => {
if (this.isActiveState()) this.setHashAndScroll()
else if (this.isActiveHash()) this.removeHash()
}
- private setHashAndScroll = () => {
+ setHashAndScroll = () => {
const { history, location } = this.props
history.replace(`${location.pathname}#${this.anchorName}`)
scrollToAnchor()
}
- private removeHash = () => {
+ removeHash = () => {
const { history, location } = this.props
history.replace(location.pathname)
@@ -161,12 +159,12 @@ class ComponentExample extends React.Component {
+ handleDirectLinkClick = () => {
this.setHashAndScroll()
copyToClipboard(window.location.href)
}
- private handleMouseLeave = () => {
+ handleMouseLeave = () => {
this.setState({
isHovering: false,
handleMouseLeave: undefined,
@@ -174,7 +172,7 @@ class ComponentExample extends React.Component {
+ handleMouseMove = () => {
this.setState({
isHovering: true,
handleMouseLeave: this.handleMouseLeave,
@@ -182,25 +180,13 @@ class ComponentExample extends React.Component {
- if (shouldShowCode !== this.state.showCode) {
- this.setState({ showCode: shouldShowCode }, this.updateHash)
- }
- }
-
- handleShowCodeInactive = (e: Event) => {
- if (this.clickedOutsideComponent(e)) {
- this.handleShowCode(false)
- }
- }
-
- private handleShowRtlClick = e => {
+ handleShowRtlClick = e => {
e.preventDefault()
this.setState(prevState => ({ showRtl: !prevState.showRtl }))
}
- private handleShowCodeClick = e => {
+ handleShowCodeClick = e => {
e.preventDefault()
const { showCode } = this.state
@@ -208,7 +194,7 @@ class ComponentExample extends React.Component {
+ handleShowVariablesClick = e => {
e.preventDefault()
const { showVariables } = this.state
@@ -216,7 +202,7 @@ class ComponentExample extends React.Component {
+ handleShowTransparentClick = e => {
e.preventDefault()
const { showTransparent } = this.state
@@ -224,36 +210,36 @@ class ComponentExample extends React.Component {
+ handlePass = () => {
const { title } = this.props
if (title) _.invoke(this.context, 'onPassed', null, this.props)
}
- private copyJSX = () => {
+ copyJSX = () => {
copyToClipboard(this.state.sourceCode)
this.setState({ copiedCode: true })
setTimeout(() => this.setState({ copiedCode: false }), 1000)
}
- private resetJSX = () => {
+ resetJSX = () => {
if (this.sourceCodeMgr.originalCodeHasChanged && confirm('Lose your changes?')) {
this.sourceCodeMgr.resetToOriginalCode()
this.updateAndRenderSourceCode()
}
}
- private getKnobsFilename = () => `./${this.props.examplePath}.knobs.tsx`
+ getKnobsFilename = () => `./${this.props.examplePath}.knobs.tsx`
- private getKebabExamplePath = () => {
+ getKebabExamplePath = () => {
if (!this.kebabExamplePath) this.kebabExamplePath = _.kebabCase(this.props.examplePath)
return this.kebabExamplePath
}
- private hasKnobs = () => _.includes(knobsContext.keys(), this.getKnobsFilename())
+ hasKnobs = () => _.includes(knobsContext.keys(), this.getKnobsFilename())
- private renderExampleFromCode = (): JSX.Element => {
+ renderExampleFromCode = (): JSX.Element => {
const { sourceCode } = this.state
if (sourceCode == null) {
@@ -263,7 +249,7 @@ class ComponentExample extends React.Component{({ element }) => element}
}
- private renderElement = (element: React.ReactElement) => {
+ renderElement = (element: React.ReactElement) => {
const { showRtl, componentVariables, themeName } = this.state
const theme = themes[themeName]
@@ -277,7 +263,7 @@ class ComponentExample extends React.Component{element}
}
- private renderMissingExample = (): JSX.Element => {
+ renderMissingExample = (): JSX.Element => {
const missingExamplePath = `./docs/src/examples/${this.sourceCodeMgr.currentPath}.tsx`
return (
@@ -287,7 +273,7 @@ class ComponentExample extends React.Component {
+ handleKnobChange = knobs => {
this.setState(prevState => ({
knobs: {
...prevState.knobs,
@@ -296,7 +282,7 @@ class ComponentExample extends React.Component {
+ getKnobsComponent = () => {
if (typeof this.KnobsComponent !== 'undefined') {
return this.KnobsComponent
}
@@ -306,35 +292,35 @@ class ComponentExample extends React.Component {
+ getKnobsValue = () => {
const Knobs = this.getKnobsComponent()
return Knobs ? { ...Knobs.defaultProps, ...this.state.knobs } : null
}
- private renderKnobs = () => {
+ renderKnobs = () => {
const Knobs = this.getKnobsComponent()
return Knobs ? : null
}
- private getDisplayName = () => this.props.examplePath.split('/')[1]
+ getDisplayName = () => this.props.examplePath.split('/')[1]
- private handleChangeCode = (sourceCode: string) => {
+ handleChangeCode = (sourceCode: string) => {
this.sourceCodeMgr.currentCode = sourceCode
this.updateAndRenderSourceCode()
}
- private updateAndRenderSourceCode = () => {
+ updateAndRenderSourceCode = () => {
this.setState({ sourceCode: this.sourceCodeMgr.currentCode })
}
- private setApiCodeType = (codeType: SourceCodeType) => {
+ setApiCodeType = (codeType: SourceCodeType) => {
this.sourceCodeMgr.codeType = codeType
this.updateAndRenderSourceCode()
}
- private renderApiCodeMenu = (): JSX.Element => {
+ renderApiCodeMenu = (): JSX.Element => {
const { sourceCode } = this.state
const lineCount = sourceCode && sourceCode.match(/^/gm)!.length
@@ -370,7 +356,23 @@ class ComponentExample extends React.Component {
+ canBePrettified = () => {
+ const { sourceCode } = this.state
+
+ try {
+ return sourceCode !== formatCode(sourceCode)
+ } catch (err) {
+ return false
+ }
+ }
+
+ handleFormat = () => {
+ const { sourceCode } = this.state
+
+ this.handleChangeCode(formatCode(sourceCode))
+ }
+
+ renderCodeEditorMenu = (): JSX.Element => {
const { copiedCode } = this.state
const { originalCodeHasChanged, currentPath } = this.sourceCodeMgr
const codeEditorStyle: React.CSSProperties = {
@@ -392,8 +394,20 @@ class ComponentExample extends React.Component
+
+ {({ error }) => (
+
+ )}
+
{
+ renderJSX = () => {
const { showCode, sourceCode } = this.state
if (!showCode) return null
@@ -426,19 +440,13 @@ class ComponentExample extends React.Component
{this.renderCodeEditorMenu()}
-
+
)
}
- private renderError = () => {
+ renderError = () => {
return (
{({ error }) =>
@@ -452,49 +460,23 @@ class ComponentExample extends React.Component {
+ renderHTML = () => {
const { showCode } = this.state
if (!showCode) return null
return (
- {({ markup }) => {
- // add new lines between almost all adjacent elements
- // moves inline elements to their own line
- const preFormattedHTML = markup.replace(/><(?!\/i|\/label|\/span)/g, '>\n<')
-
- const beautifiedHTML = html(preFormattedHTML, {
- indent_size: 2,
- indent_char: ' ',
- wrap_attributes: 'auto',
- wrap_attributes_indent_size: 2,
- end_with_newline: false,
- })
-
- return (
-
- )
- }}
+ {({ markup }) => (
+
+ )}
)
}
- private renderVariables = () => {
+ renderVariables = () => {
const { showVariables } = this.state
if (!showVariables) return undefined
@@ -547,7 +529,7 @@ class ComponentExample extends React.Component (e, { value }) => {
+ handleVariableChange = (component, variable) => (e, { value }) => {
this.setState(state => ({
componentVariables: {
...state.componentVariables,
@@ -556,7 +538,7 @@ class ComponentExample extends React.Component (this.componentRef = c!)}
- >
+
{/* Ensure anchor links don't occlude card shadow effect */}
{
{exceeds && }
- {_.map(sliced, value => {value})}
+ {_.map(sliced, value => (
+ {value}
+ ))}
{exceeds && !showAll && '...'}
diff --git a/docs/src/components/ComponentDoc/ComponentTable/ComponentTable.tsx b/docs/src/components/ComponentDoc/ComponentTable/ComponentTable.tsx
index fcb71afbe4..f4dfc36730 100644
--- a/docs/src/components/ComponentDoc/ComponentTable/ComponentTable.tsx
+++ b/docs/src/components/ComponentDoc/ComponentTable/ComponentTable.tsx
@@ -13,7 +13,9 @@ const ComponentTable: any = ({ props }) => (
- {_.map(props, propDef => )}
+ {_.map(props, propDef => (
+
+ ))}
)
diff --git a/docs/src/components/Editor/Editor.tsx b/docs/src/components/Editor/Editor.tsx
index a7278f19a1..44f66a07ce 100644
--- a/docs/src/components/Editor/Editor.tsx
+++ b/docs/src/components/Editor/Editor.tsx
@@ -8,7 +8,6 @@ import 'brace/mode/html'
import 'brace/mode/jsx'
import 'brace/mode/sh'
import 'brace/theme/tomorrow_night'
-import { doesNodeContainClick, EventStack } from 'src/lib'
const parentComponents = []
@@ -46,35 +45,28 @@ const semanticUIReactCompleter = {
languageTools.addCompleter(semanticUIReactCompleter)
export interface EditorProps extends AceEditorProps {
- id: string
- value?: string
- mode?: 'html' | 'jsx' | 'sh'
- onClick?: () => void
- onOutsideClick?: (e: Event) => void
active?: boolean
- showCursor?: boolean
highlightGutterLine?: boolean
+ mode?: 'html' | 'jsx' | 'sh'
+ value?: string
+ showCursor?: boolean
}
export const EDITOR_BACKGROUND_COLOR = '#1D1F21'
export const EDITOR_GUTTER_COLOR = '#26282d'
class Editor extends React.Component {
- private static readonly refName = 'aceEditor'
- private clickSubscription = EventStack.noSubscription
+ editorRef: any
+ name = `docs-editor-${_.uniqueId()}`
- public static propTypes = {
- id: PropTypes.string.isRequired,
+ static propTypes = {
value: PropTypes.string.isRequired,
mode: PropTypes.oneOf(['html', 'jsx', 'sh']),
- onClick: PropTypes.func,
- onOutsideClick: PropTypes.func,
active: PropTypes.bool,
showCursor: PropTypes.bool,
}
- public static defaultProps = {
- id: '',
+ static defaultProps = {
value: '',
mode: 'jsx',
theme: 'tomorrow_night',
@@ -84,6 +76,7 @@ class Editor extends React.Component {
enableBasicAutocompletion: true,
enableLiveAutocompletion: true,
editorProps: { $blockScrolling: Infinity },
+ setOptions: { fixedWidthGutter: true, showFoldWidgets: false },
showPrintMargin: false,
tabSize: 2,
maxLines: Infinity,
@@ -93,7 +86,12 @@ class Editor extends React.Component {
showCursor: true,
}
- public componentWillReceiveProps(nextProps: EditorPropsWithDefaults) {
+ componentDidMount() {
+ const { showCursor } = this.props
+ this.setCursorVisibility(showCursor)
+ }
+
+ componentWillReceiveProps(nextProps) {
const previousPros = this.props
const { active, showCursor } = nextProps
@@ -101,90 +99,21 @@ class Editor extends React.Component {
this.setCursorVisibility(showCursor)
}
- if (active !== previousPros.active) {
- if (active) {
- this.editor.focus() // focus editor when editor is active
- this.addDocumentListener()
- } else {
- this.removeDocumentListener()
- }
+ // focus editor when editor it becomes active
+ if (active !== previousPros.active && active) {
+ this.editorRef.editor.focus()
}
}
- public componentDidMount() {
- const { active, showCursor } = this.props as EditorPropsWithDefaults
+ setCursorVisibility = visible => {
+ const cursor = this.editorRef.editor.renderer.$cursorLayer.element
- this.setCursorVisibility(showCursor)
-
- if (active) {
- this.addDocumentListener()
- }
+ cursor.style.display = visible ? '' : 'none'
}
- public componentWillUnmount() {
- this.removeDocumentListener()
- }
-
- public render() {
- const { id, onClick, ...rest } = this.props
-
- return (
-
- )
- }
-
- private handleDocumentClick = (e: Event) => {
- const { onOutsideClick } = this.props
- if (!doesNodeContainClick(this.container, e) && onOutsideClick) {
- onOutsideClick(e)
- }
- }
-
- private addDocumentListener() {
- this.clickSubscription.unsubscribe()
- this.clickSubscription = EventStack.subscribe('click', this.handleDocumentClick)
- }
-
- private removeDocumentListener() {
- this.clickSubscription.unsubscribe()
- }
-
- private get editor() {
- return this.safeCall(() => (this.refs[Editor.refName] as any).editor)
- }
-
- private get renderer() {
- return this.safeCall(() => this.editor.renderer)
- }
-
- private get cursor(): HTMLElement {
- return this.safeCall(() => this.renderer.$cursorLayer.element)
- }
-
- private get container(): HTMLElement {
- return this.safeCall(() => this.renderer.container)
- }
-
- private setCursorVisibility(visible: boolean): void {
- this.safeCall(() => {
- this.cursor.style.display = visible ? '' : 'none'
- })
- }
-
- private safeCall(cb: () => T, logError?: boolean): T | undefined {
- try {
- return cb()
- } catch (error) {
- if (logError) {
- console.error(`Editor.tsx:safeCall error: ${error}`)
- }
- return undefined
- }
+ render() {
+ return (this.editorRef = c)} />
}
}
export default Editor
-
-export type EditorPropsWithDefaults = EditorProps & (typeof Editor.defaultProps)
diff --git a/docs/src/components/ExampleSnippet/ExampleSnippet.tsx b/docs/src/components/ExampleSnippet/ExampleSnippet.tsx
index 7d44e943d4..165f08c71b 100644
--- a/docs/src/components/ExampleSnippet/ExampleSnippet.tsx
+++ b/docs/src/components/ExampleSnippet/ExampleSnippet.tsx
@@ -1,24 +1,56 @@
import * as React from 'react'
-import CodeSnippet, { CodeSnippetProps } from '../CodeSnippet'
+import reactElementToJSXString from 'react-element-to-jsx-string'
+import CodeSnippet from '../CodeSnippet'
-const ExampleSnippet = ({
- render,
- style,
- ...rest
-}: CodeSnippetProps & {
+export type ExampleSnippetProps = {
+ value?: string
render?: () => React.ReactNode
-}) => (
-
-
- {render &&
{render()}
}
-
-)
+}
+
+const rootStyle = {
+ background: 'white',
+ marginBottom: '2rem',
+ boxShadow: '0 0 2px rgba(0, 0, 0, 0.2)',
+}
+
+const renderedStyle = {
+ padding: '1rem',
+}
+
+const ExampleSnippet = ({ render = () => null, value }: ExampleSnippetProps) => {
+ let renderHasFunction
+
+ const element = render()
+ const string =
+ value ||
+ reactElementToJSXString(element, {
+ showDefaultProps: false,
+ showFunctions: true,
+ functionValue: fn => (renderHasFunction = true),
+ })
+
+ if (process.env.NODE_ENV !== 'production') {
+ if (renderHasFunction && !value) {
+ throw new Error(
+ [
+ "This ExampleSnippet's render prop output includes function.",
+ ' A helpful JSX string cannot be generated for functions.',
+ ' Please define a `value` string prop that displays readable code to the user.',
+ '\n\n',
+ 'RENDERED:',
+ '\n\n',
+ string,
+ ].join(''),
+ )
+ }
+ }
+
+ return (
+
+
+ {element &&
{element}
}
+
+ )
+}
export default ExampleSnippet
diff --git a/docs/src/examples/components/Button/Usage/index.tsx b/docs/src/examples/components/Button/Usage/index.tsx
index 9485fe95c6..73cb8987fc 100644
--- a/docs/src/examples/components/Button/Usage/index.tsx
+++ b/docs/src/examples/components/Button/Usage/index.tsx
@@ -6,7 +6,7 @@ const Usage = () => (
diff --git a/docs/src/examples/components/Chat/Types/ChatMessageExampleStyled.shorthand.tsx b/docs/src/examples/components/Chat/Types/ChatMessageExampleStyled.shorthand.tsx
index 78f4acdb40..84f895029f 100644
--- a/docs/src/examples/components/Chat/Types/ChatMessageExampleStyled.shorthand.tsx
+++ b/docs/src/examples/components/Chat/Types/ChatMessageExampleStyled.shorthand.tsx
@@ -8,9 +8,11 @@ const janeAvatar = {
const content = (
)
diff --git a/docs/src/examples/components/Chat/Types/ChatMessageExampleStyled.tsx b/docs/src/examples/components/Chat/Types/ChatMessageExampleStyled.tsx
index 332dad7599..110553fd61 100644
--- a/docs/src/examples/components/Chat/Types/ChatMessageExampleStyled.tsx
+++ b/docs/src/examples/components/Chat/Types/ChatMessageExampleStyled.tsx
@@ -8,9 +8,11 @@ const janeAvatar = {
const content = (
)
diff --git a/docs/src/examples/components/Popup/Variations/PopupExamplePosition.shorthand.tsx b/docs/src/examples/components/Popup/Variations/PopupExamplePosition.shorthand.tsx
index 03421b0325..d3d4e44603 100644
--- a/docs/src/examples/components/Popup/Variations/PopupExamplePosition.shorthand.tsx
+++ b/docs/src/examples/components/Popup/Variations/PopupExamplePosition.shorthand.tsx
@@ -12,7 +12,9 @@ const PopupWithButton = props => {
content={{
content: (
- The popup is rendered {position} the trigger
aligned to the {align}.
+ The popup is rendered {position} the trigger
+
+ aligned to the {align}.
),
}}
diff --git a/docs/src/examples/components/Popup/Variations/PopupExamplePosition.tsx b/docs/src/examples/components/Popup/Variations/PopupExamplePosition.tsx
index 1624a03b6d..64de34d011 100644
--- a/docs/src/examples/components/Popup/Variations/PopupExamplePosition.tsx
+++ b/docs/src/examples/components/Popup/Variations/PopupExamplePosition.tsx
@@ -13,7 +13,9 @@ const PopupArrowExample = props => {
content={{
content: (
- The popup is rendered {position} the trigger
aligned to the {align}.
+ The popup is rendered {position} the trigger
+
+ aligned to the {align}.
),
}}
diff --git a/docs/src/examples/components/Portal/Types/PortalExample.shorthand.tsx b/docs/src/examples/components/Portal/Types/PortalExample.shorthand.tsx
index 84589f8d69..fa47e224a9 100644
--- a/docs/src/examples/components/Portal/Types/PortalExample.shorthand.tsx
+++ b/docs/src/examples/components/Portal/Types/PortalExample.shorthand.tsx
@@ -45,7 +45,11 @@ class PortalExamplePortal extends React.Component {
Event Log
- {log.map((e, i) => {e}
)}
+
+ {log.map((e, i) => (
+ {e}
+ ))}
+
)
diff --git a/docs/src/examples/components/Portal/Types/PortalExample.tsx b/docs/src/examples/components/Portal/Types/PortalExample.tsx
index 9d3ef90b1e..cc642bb397 100644
--- a/docs/src/examples/components/Portal/Types/PortalExample.tsx
+++ b/docs/src/examples/components/Portal/Types/PortalExample.tsx
@@ -42,7 +42,11 @@ class PortalExamplePortal extends React.Component {
Event Log
- {log.map((e, i) => {e}
)}
+
+ {log.map((e, i) => (
+ {e}
+ ))}
+
)
diff --git a/docs/src/examples/components/Portal/Types/PortalExampleControlled.shorthand.tsx b/docs/src/examples/components/Portal/Types/PortalExampleControlled.shorthand.tsx
index 97aa049f27..e4b40bc9e4 100644
--- a/docs/src/examples/components/Portal/Types/PortalExampleControlled.shorthand.tsx
+++ b/docs/src/examples/components/Portal/Types/PortalExampleControlled.shorthand.tsx
@@ -30,7 +30,11 @@ class PortalExampleControlled extends React.Component {
Event Log
- {log.map((e, i) => {e}
)}
+
+ {log.map((e, i) => (
+ {e}
+ ))}
+
Event Log
- {log.map((e, i) => {e}
)}
+
+ {log.map((e, i) => (
+ {e}
+ ))}
+
-
+
+
+
-
+
-
-
+
+
+