UNPKG

nice-ui

Version:

React design system, components, and utilities

40 lines (39 loc) 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Page = void 0; const React = require("react"); const nano_theme_1 = require("nano-theme"); const useTitle_1 = require("react-use/lib/useTitle"); const constants_1 = require("../../constants"); const blockClass = (0, nano_theme_1.rule)({ maxW: constants_1.NiceUiSizes.SiteWidth + constants_1.NiceUiSizes.SitePadding + constants_1.NiceUiSizes.SitePadding + 'px', minW: constants_1.NiceUiSizes.MinSiteWidth + 'px', margin: 'auto', bxz: 'border-box', pad: `${constants_1.NiceUiSizes.TopNavHeight}px 32px 0`, '@media only screen and (max-width: 600px)': { padl: '16px', padr: '16px', }, '&:focus': { outline: 'none', }, }); const Page = ({ hackFooterLocation, withSubNav, title = 'json joy', children }) => { (0, useTitle_1.default)(title); const style = { paddingTop: withSubNav ? constants_1.NiceUiSizes.TopNavHeight : 0, }; if (hackFooterLocation) { style.minHeight = '100vh'; style.paddingBottom = constants_1.NiceUiSizes.FooterHeight; } let element = (React.createElement("main", { id: "main-content", tabIndex: -1, className: blockClass, style: style }, children)); if (hackFooterLocation) { element = (React.createElement(React.Fragment, null, element, React.createElement("div", { style: { marginTop: -constants_1.NiceUiSizes.FooterHeight } }))); } return React.createElement(React.Fragment, null, element); }; exports.Page = Page;