@morfeo/hooks
Version:

20 lines • 819 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useProps = void 0;
const core_1 = require("@morfeo/core");
const useSyncMorfeo_1 = require("./useSyncMorfeo");
/**
* useProps
* It returns the default properties of the component.
* @param componentName the name of the component inside the Theme components slice
* @param variant the component variant
* @returns the component's default props
*/
function useProps(componentName, variant) {
(0, useSyncMorfeo_1.useSyncMorfeo)();
const { props, variants = {} } = core_1.morfeo.theme.getValue('components', componentName) || {};
const { props: variantProps } = variants[variant] || {};
return Object.assign(Object.assign({}, props), variantProps);
}
exports.useProps = useProps;
//# sourceMappingURL=useProps.js.map