We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 35b1d2d commit f8327baCopy full SHA for f8327ba
packages/ui/src/components/if/index.ts
@@ -0,0 +1,3 @@
1
+export { default as If } from './source/If';
2
+
3
+export * from './type';
packages/ui/src/components/if/source/If.tsx
@@ -0,0 +1,7 @@
+import type { IfProps } from '../type';
+function If({ children, condition, fallback }: IfProps) {
4
+ return condition ? children : fallback;
5
+}
6
7
+export default If;
packages/ui/src/components/if/type.ts
@@ -0,0 +1,16 @@
+import type { ReactNode } from 'react';
+export interface IfProps {
+ /**
+ * The children to render
+ */
+ children?: ReactNode;
8
9
+ * If true, the children will be rendered
10
11
+ condition: boolean;
12
13
+ * The fallback to render
14
15
+ fallback?: ReactNode;
16
0 commit comments