mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
feat: add feature guard as hook and component.
This commit is contained in:
13
src/components/FeatureGuard/FeatureCan.js
Normal file
13
src/components/FeatureGuard/FeatureCan.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import React from 'react';
|
||||
import * as R from 'ramda';
|
||||
import withFeatureCan from './withFeatureCan';
|
||||
|
||||
function FeatureCanJSX({ feature, children, isFeatureCan }) {
|
||||
return isFeatureCan && children;
|
||||
}
|
||||
|
||||
export const FeatureCan = R.compose(
|
||||
withFeatureCan(({ isFeatureCan }) => ({
|
||||
isFeatureCan,
|
||||
})),
|
||||
)(FeatureCanJSX);
|
||||
Reference in New Issue
Block a user