UNPKG

sccoreui

Version:

ui-sccore

22 lines (21 loc) 1.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const jsx_runtime_1 = require("react/jsx-runtime"); const react_1 = require("react"); const context_provider_1 = require("../context-provider"); const svg_component_1 = tslib_1.__importDefault(require("../../../directives/svg-component")); const helper_1 = require("../helper"); const utilComponents_1 = require("../utilComponents"); const FeatureSkeleton_1 = tslib_1.__importDefault(require("../../skeletons/FeatureSkeleton")); function RefreshGrid() { const { removeFeaturesAndRefresh, conditionsToDisplay } = (0, react_1.useContext)(context_provider_1.FeatureContext); const isDisabled = (0, helper_1.isComponentDisable)(conditionsToDisplay.displayRefresh); const refreshHandler = () => { if (!isDisabled) { removeFeaturesAndRefresh(); } }; return (0, utilComponents_1.skeletonLoding)() ? ((0, jsx_runtime_1.jsx)(FeatureSkeleton_1.default, {})) : ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `rounded_btn sc_icon_hover icon-40x40 ${isDisabled && "disabled"}`, onClick: refreshHandler, title: "Refresh" }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "refresh-ccw-01", color: "text-gray-500" }) }))); } exports.default = RefreshGrid;