UNPKG

@sanity/default-layout

Version:

The default layout components for Sanity

28 lines (26 loc) 1.09 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HAS_SPACES = exports.CONFIGURED_SPACES = void 0; var _capitalize2 = _interopRequireDefault(require("lodash/capitalize")); var _configSanity = _interopRequireDefault(require("config:sanity")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // @todo: remove the following line when part imports has been removed from this file ///<reference types="@sanity/types/parts" /> var FEATURE_KEY = '__experimental_spaces'; function prepareSpace(space) { return Object.assign({}, space, { title: space.title || (0, _capitalize2.default)(space.name) }); } function getConfiguredSpaces() { if (!_configSanity.default[FEATURE_KEY]) { return null; } return _configSanity.default[FEATURE_KEY] && _configSanity.default[FEATURE_KEY].map(prepareSpace); } var CONFIGURED_SPACES = getConfiguredSpaces(); exports.CONFIGURED_SPACES = CONFIGURED_SPACES; var HAS_SPACES = CONFIGURED_SPACES && CONFIGURED_SPACES.length > 0; exports.HAS_SPACES = HAS_SPACES;