mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
13 lines
357 B
TypeScript
13 lines
357 B
TypeScript
import React from 'react';
|
|
|
|
interface ConditionalWrapProps {
|
|
shouldWrap: boolean;
|
|
children: JSX.Element;
|
|
wrap: (children: JSX.Element) => JSX.Element;
|
|
}
|
|
|
|
export const ConditionalWrap = ({ shouldWrap, children, wrap }: ConditionalWrapProps): JSX.Element =>
|
|
shouldWrap ? React.cloneElement(wrap(children)) : children;
|
|
|
|
export default ConditionalWrap;
|