mirror of
https://github.com/Snigdha-OS/documentation.git
synced 2025-09-15 20:34:56 +02:00
23 lines
723 B
JavaScript
23 lines
723 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
import React from 'react';
|
|
import Details from '@theme/Details';
|
|
export default function MDXDetails(props) {
|
|
const items = React.Children.toArray(props.children);
|
|
// Split summary item from the rest to pass it as a separate prop to the
|
|
// Details theme component
|
|
const summary = items.find(
|
|
(item) => React.isValidElement(item) && item.type === 'summary',
|
|
);
|
|
const children = <>{items.filter((item) => item !== summary)}</>;
|
|
return (
|
|
<Details {...props} summary={summary}>
|
|
{children}
|
|
</Details>
|
|
);
|
|
}
|