@wordpress/block-editor
Version:
49 lines (45 loc) • 1.09 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = HeadingLevelIcon;
var _icons = require("@wordpress/icons");
var _components = require("@wordpress/components");
var _jsxRuntime = require("react/jsx-runtime");
/**
* WordPress dependencies
*/
/** @typedef {import('react').ComponentType} ComponentType */
/**
* HeadingLevelIcon props.
*
* @typedef WPHeadingLevelIconProps
*
* @property {number} level The heading level to show an icon for.
*/const LEVEL_TO_PATH = {
0: _icons.paragraph,
1: _icons.headingLevel1,
2: _icons.headingLevel2,
3: _icons.headingLevel3,
4: _icons.headingLevel4,
5: _icons.headingLevel5,
6: _icons.headingLevel6
};
/**
* Heading level icon.
*
* @param {WPHeadingLevelIconProps} props Component props.
*
* @return {?ComponentType} The icon.
*/
function HeadingLevelIcon({
level
}) {
if (LEVEL_TO_PATH[level]) {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Icon, {
icon: LEVEL_TO_PATH[level]
});
}
return null;
}
//# sourceMappingURL=heading-level-icon.js.map
;