UNPKG

@awsui/components-react

Version:

AWS UI is a collection of [React](https://reactjs.org/) components that help create intuitive, responsive, and accessible user experiences for web applications. It is developed by Amazon Web Services (AWS). This work is available under the terms of the [A

22 lines (21 loc) 1.65 kB
import { __assign, __rest } from "tslib"; import clsx from 'clsx'; import React, { useRef } from 'react'; import { useStickyHeader } from './use-sticky-header'; import { getBaseProps } from '../internal/base-component'; import styles from './styles.css.js'; export default function Container(_a) { var _b; var header = _a.header, disableHeaderPaddings = _a.disableHeaderPaddings, footer = _a.footer, children = _a.children, disableContentPaddings = _a.disableContentPaddings, __stickyHeader = _a.__stickyHeader, __stickyOffset = _a.__stickyOffset, restProps = __rest(_a, ["header", "disableHeaderPaddings", "footer", "children", "disableContentPaddings", "__stickyHeader", "__stickyOffset"]); var baseProps = getBaseProps(restProps); var rootRef = useRef(null); var headerRef = useRef(null); var _c = useStickyHeader(rootRef, headerRef, __stickyHeader, __stickyOffset), isSticky = _c.isSticky, stickyStyles = _c.stickyStyles; return (React.createElement("div", __assign({}, baseProps, { className: clsx(baseProps.className, styles.root), ref: rootRef }), header && (React.createElement("div", __assign({ className: clsx(styles.header, disableHeaderPaddings && styles['header-no-paddings'], isSticky && styles['header-sticky']) }, stickyStyles, { ref: headerRef }), header)), React.createElement("div", { className: clsx(styles.content, (_b = {}, _b[styles['content-no-paddings']] = disableContentPaddings, _b[styles['content-has-header']] = header, _b)) }, children), footer && React.createElement("div", { className: styles.footer }, footer))); }