@sap-ux/ui-components
Version:
SAP UI Components Library
44 lines • 1.86 kB
JavaScript
import React from 'react';
import { divProperties, getNativeProps } from '@fluentui/react';
import './UISection.scss';
export var UISectionLayout;
(function (UISectionLayout) {
UISectionLayout["Standard"] = "standard";
UISectionLayout["Extended"] = "extended";
})(UISectionLayout || (UISectionLayout = {}));
/**
* Section Component.
*
* @exports
* @class {UISection}
* @extends {React.Component<UISectionProps>}
*/
export class UISection extends React.Component {
onScroll() {
if (this.props.onScroll) {
this.props.onScroll();
}
}
/**
* @returns {React.ReactElement}
*/
render() {
const scrollable = this.props.scrollable === undefined || this.props.scrollable;
const style = {};
const layout = this.props.layout ?? UISectionLayout.Standard;
if ('height' in this.props) {
style.height = this.props.height;
}
const divProps = getNativeProps(this.props, divProperties, [
'onScroll',
'className',
'children'
]);
return (React.createElement("div", { ...divProps, className: `section${this.props.className ? ' ' + this.props.className : ''} section--${layout}${scrollable ? ' section--scrollable' : ''}${this.props.cleanPadding ? ' section--clean' : ''}${this.props.hidden ? ' section--hidden' : ''}`, style: style, ref: this.props.rootRef },
this.props.title && (React.createElement("div", { className: "section__header" },
React.createElement("div", null,
React.createElement("span", { className: "section__header__title ui-medium-header" }, this.props.title)))),
React.createElement("div", { className: "section__body", onScroll: this.onScroll.bind(this) }, this.props.children)));
}
}
//# sourceMappingURL=UISection.js.map