mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 23:00:34 +00:00
fix: add TypeScript types to If component
This commit is contained in:
@@ -1,12 +1,10 @@
|
|||||||
// @ts-nocheck
|
import React, { ReactNode } from 'react';
|
||||||
import React from 'react';
|
|
||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
export const If = (props) =>
|
interface IfProps {
|
||||||
props.condition ? (props.render ? props.render() : props.children) : null;
|
condition: boolean;
|
||||||
|
children?: ReactNode;
|
||||||
|
render?: () => ReactNode;
|
||||||
|
}
|
||||||
|
|
||||||
If.propTypes = {
|
export const If = (props: IfProps): React.ReactElement | null =>
|
||||||
// condition: PropTypes.bool.isRequired,
|
props.condition ? (props.render ? <>{props.render()}</> : <>{props.children}</>) : null;
|
||||||
children: PropTypes.node,
|
|
||||||
render: PropTypes.func,
|
|
||||||
};
|
|
||||||
|
|||||||
Reference in New Issue
Block a user