Fix infobox with ID [ci skip]
-import React from 'react'
+import React, { Fragment } from 'react'
import PropTypes from 'prop-types'
import classNames from 'classnames'
@@ -14,13 +14,14 @@ export default function Infobox({
className,
children,
}) {
+ const Wrapper = id ? 'div' : Fragment
const infoboxClassNames = classNames(classes.root, className, {
[classes.list]: !!list,
[classes.warning]: variant === 'warning',
[classes.danger]: variant === 'danger',
})
return (
- <>
+ <Wrapper>
{id && <a id={id} />}
<aside className={infoboxClassNames}>
{title && (
@@ -40,7 +41,7 @@ export default function Infobox({
)}
{children}
</aside>
- </>
+ </Wrapper>
)
}
