stackpress
Version:
Incept is a content management framework.
20 lines (19 loc) • 1.52 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
export default function LayoutHead(props) {
const { open, theme, base, logo, brand, left, right, toggleLeft, toggleRight, toggleTheme } = props;
const classNames = ['layout-head'];
if (left) {
classNames.push('left');
}
if (right) {
classNames.push('right');
}
if (open?.left) {
classNames.push('open-left');
}
if (open?.right) {
classNames.push('open-right');
}
const themeIcon = theme === 'dark' ? 'fa-moon' : 'fa-sun';
return (_jsx("header", { className: classNames.join(' '), children: _jsxs("div", { className: "container", children: [toggleLeft && (_jsx("button", { className: "menu", onClick: toggleLeft, children: _jsx("i", { className: "fas fa-bars" }) })), _jsx("div", { className: "bar", children: base ? (_jsxs("a", { href: base, children: [logo && _jsx("img", { src: logo, alt: brand, className: "logo" }), brand && _jsx("span", { className: "brand", children: brand })] })) : (brand || logo) ? (_jsxs("span", { children: [logo && _jsx("img", { src: logo, alt: brand, className: "logo" }), brand && _jsx("span", { className: "brand", children: brand })] })) : undefined }), toggleTheme && (_jsx("button", { className: "theme", onClick: () => toggleTheme(), children: _jsx("i", { className: `fas ${themeIcon}` }) })), toggleRight && (_jsx("button", { className: "user", onClick: toggleRight, children: _jsx("i", { className: "fas fa-user-circle" }) }))] }) }));
}