From 8543aa289f449cb8815b7026835682551ea1845f Mon Sep 17 00:00:00 2001 From: Mark Rosenberg <38965626+markdoeswork@users.noreply.github.com> Date: Thu, 19 Dec 2024 08:35:22 -0500 Subject: [PATCH] [PLAY-1742] Global Height Fixes (#3972) **What does this PR do?** A clear and concise description with your runway ticket url. Runway https://runway.powerhrg.com/backlog_items/PLAY-1742 Our global height prop doesn't work the way we were expecting for some of our kits Examples of how we should use them are here https://codesandbox.io/p/sandbox/global-height-props-forked-wfc9vf - Layout - Add global props the the children kits `Layout.Body` `Layout.Side` and the others - Collapsible - Uses height to show and hide content i think it would be dangerous to change, just wrap the entire thing in a container with overflow and height - Drawer - I fixed it - Overlay - Works is just weird - Section Separator - Just weird - Table - Max height needs to be wrapped in a container. Could add an "inline size" that removes a lot of our padding and other styles. Because the table kit is really just a bunch of styles - Flex Items - Weird --- .../pb_kits/playbook/pb_drawer/_drawer.tsx | 4 +- .../pb_kits/playbook/pb_layout/_layout.tsx | 41 ++++++++++++++----- 2 files changed, 32 insertions(+), 13 deletions(-) diff --git a/playbook/app/pb_kits/playbook/pb_drawer/_drawer.tsx b/playbook/app/pb_kits/playbook/pb_drawer/_drawer.tsx index 314959b713..23d53d4e77 100644 --- a/playbook/app/pb_kits/playbook/pb_drawer/_drawer.tsx +++ b/playbook/app/pb_kits/playbook/pb_drawer/_drawer.tsx @@ -287,7 +287,6 @@ const Drawer = (props: DrawerProps): React.ReactElement => { {...ariaProps} {...dataProps} {...htmlProps} - style={dynamicInlineProps} className={classnames(drawerClassNames.base, { [drawerClassNames.afterOpen]: animationState === "afterOpen", @@ -296,6 +295,7 @@ const Drawer = (props: DrawerProps): React.ReactElement => { })} id={id} onClick={(e) => e.stopPropagation()} + style={dynamicInlineProps} > {children} @@ -306,7 +306,6 @@ const Drawer = (props: DrawerProps): React.ReactElement => { {...dataProps} {...htmlProps} className={classes} - style={dynamicInlineProps} > {isModalVisible && (
{ animationState === "beforeClose", })} onClick={(e) => e.stopPropagation()} + style={dynamicInlineProps} > {children}
diff --git a/playbook/app/pb_kits/playbook/pb_layout/_layout.tsx b/playbook/app/pb_kits/playbook/pb_layout/_layout.tsx index 5d7fa88029..56fb6120af 100755 --- a/playbook/app/pb_kits/playbook/pb_layout/_layout.tsx +++ b/playbook/app/pb_kits/playbook/pb_layout/_layout.tsx @@ -24,34 +24,37 @@ type LayoutPropTypes = { type LayoutSideProps = { children: React.ReactNode[] | React.ReactNode, className?: string, -} +} & GlobalProps type LayoutBodyProps = { children: React.ReactNode[] | React.ReactNode, className?: string, -} +} & GlobalProps type LayoutItemProps = { children: React.ReactNode[] | React.ReactNode, className?: string, size?: "sm" | "md" | "lg" -} +} & GlobalProps type LayoutHeaderProps = { children: React.ReactNode[] | React.ReactNode, className?: string, -} +} & GlobalProps type LayoutFooterProps = { children: React.ReactNode[] | React.ReactNode, className?: string, -} +} & GlobalProps -// Side component const Side = (props: LayoutSideProps) => { const { children, className } = props + const dynamicInlineProps = globalInlineProps(props) return ( -
+
{children}
) @@ -60,8 +63,12 @@ const Side = (props: LayoutSideProps) => { // Body component const Body = (props: LayoutBodyProps) => { const { children, className } = props + const dynamicInlineProps = globalInlineProps(props) return ( -
+
{children}
) @@ -71,8 +78,12 @@ const Body = (props: LayoutBodyProps) => { const Item = (props: LayoutItemProps) => { const { children, className, size = 'sm' } = props const sizeClass = `size_${size}` + const dynamicInlineProps = globalInlineProps(props) return ( -
+
{children}
) @@ -81,8 +92,12 @@ const Item = (props: LayoutItemProps) => { // Header component const Header = (props: LayoutHeaderProps) => { const { children, className } = props + const dynamicInlineProps = globalInlineProps(props) return ( -
+
{children}
) @@ -91,8 +106,12 @@ const Header = (props: LayoutHeaderProps) => { // Footer component const Footer = (props: LayoutFooterProps) => { const { children, className } = props + const dynamicInlineProps = globalInlineProps(props) return ( -
+
{children}
)