"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = PostSticky;
var _i18n = require("@wordpress/i18n");
var _components = require("@wordpress/components");
var _data = require("@wordpress/data");
var _check = _interopRequireDefault(require("./check"));
var _store = require("../../store");
var _jsxRuntime = require("react/jsx-runtime");
/**
 * WordPress dependencies
 */

/**
 * Internal dependencies
 */

/**
 * Renders the PostSticky component. It provides a checkbox control for the sticky post feature.
 *
 * @return {React.ReactNode} The rendered component.
 */function PostSticky() {
  const postSticky = (0, _data.useSelect)(select => {
    var _select$getEditedPost;
    return (_select$getEditedPost = select(_store.store).getEditedPostAttribute('sticky')) !== null && _select$getEditedPost !== void 0 ? _select$getEditedPost : false;
  }, []);
  const {
    editPost
  } = (0, _data.useDispatch)(_store.store);
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_check.default, {
    children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.CheckboxControl, {
      className: "editor-post-sticky__checkbox-control",
      label: (0, _i18n.__)('Sticky'),
      help: (0, _i18n.__)('Pin this post to the top of the blog'),
      checked: postSticky,
      onChange: () => editPost({
        sticky: !postSticky
      }),
      __nextHasNoMarginBottom: true
    })
  });
}
//# sourceMappingURL=index.js.map