@parkassist/pa-ui-library
Version:
INX Platform elements
51 lines • 1.71 kB
JavaScript
var __rest = this && this.__rest || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
}
return t;
};
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import React from "react";
import { Column } from "../Flex";
import MediaQuery from "react-responsive";
import { TriangleWrapper, SectionTitleWrapper, TitleWrapper } from "./styled";
export const Title = ({
children
}) => _jsxs(TitleWrapper, {
children: [_jsx(TriangleWrapper, {
className: "section-title--triangle",
children: "\u25B6"
}), _jsx(Column, {
style: {
textTransform: "uppercase",
justifyContent: "center"
},
children: children ? children : window.location.href.split("?").shift().split("/").pop().replace(/-/g, " ")
})]
});
const SectionTitleComponent = _a => {
var {
title,
titleComponent,
currentSite,
className
} = _a,
props = __rest(_a, ["title", "titleComponent", "currentSite", "className"]);
const hasTitle = Boolean(title || titleComponent);
return _jsx(MediaQuery, {
minWidth: 500,
children: _jsx(SectionTitleWrapper, Object.assign({
style: {
justifyContent: hasTitle ? "space-between" : "flex-end"
},
className: className
}, props, {
children: title ? _jsx(Title, {
children: title
}) : titleComponent
}))
});
};
export default SectionTitleComponent;