Skip to content

Commit

Permalink
[PLAY-1742] Global Height Fixes (#3972)
Browse files Browse the repository at this point in the history
**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
  • Loading branch information
markdoeswork authored Dec 19, 2024
1 parent bd9f07c commit 8543aa2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
4 changes: 2 additions & 2 deletions playbook/app/pb_kits/playbook/pb_drawer/_drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
{...ariaProps}
{...dataProps}
{...htmlProps}
style={dynamicInlineProps}
className={classnames(drawerClassNames.base, {
[drawerClassNames.afterOpen]:
animationState === "afterOpen",
Expand All @@ -296,6 +295,7 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
})}
id={id}
onClick={(e) => e.stopPropagation()}
style={dynamicInlineProps}
>
{children}
</div>
Expand All @@ -306,7 +306,6 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
{...dataProps}
{...htmlProps}
className={classes}
style={dynamicInlineProps}
>
{isModalVisible && (
<div
Expand All @@ -327,6 +326,7 @@ const Drawer = (props: DrawerProps): React.ReactElement => {
animationState === "beforeClose",
})}
onClick={(e) => e.stopPropagation()}
style={dynamicInlineProps}
>
{children}
</div>
Expand Down
41 changes: 30 additions & 11 deletions playbook/app/pb_kits/playbook/pb_layout/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div className={classnames('layout_sidebar', globalProps(props), className)}>
<div
className={classnames('layout_sidebar', globalProps(props), className)}
style={dynamicInlineProps}
>
{children}
</div>
)
Expand All @@ -60,8 +63,12 @@ const Side = (props: LayoutSideProps) => {
// Body component
const Body = (props: LayoutBodyProps) => {
const { children, className } = props
const dynamicInlineProps = globalInlineProps(props)
return (
<div className={classnames('layout_body', globalProps(props), className)}>
<div
className={classnames('layout_body', globalProps(props), className)}
style={dynamicInlineProps}
>
{children}
</div>
)
Expand All @@ -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 (
<div className={classnames('layout_item', sizeClass, globalProps(props), className)}>
<div
className={classnames('layout_item', sizeClass, globalProps(props), className)}
style={dynamicInlineProps}
>
{children}
</div>
)
Expand All @@ -81,8 +92,12 @@ const Item = (props: LayoutItemProps) => {
// Header component
const Header = (props: LayoutHeaderProps) => {
const { children, className } = props
const dynamicInlineProps = globalInlineProps(props)
return (
<div className={classnames('layout_header', globalProps(props), className)}>
<div
className={classnames('layout_header', globalProps(props), className)}
style={dynamicInlineProps}
>
{children}
</div>
)
Expand All @@ -91,8 +106,12 @@ const Header = (props: LayoutHeaderProps) => {
// Footer component
const Footer = (props: LayoutFooterProps) => {
const { children, className } = props
const dynamicInlineProps = globalInlineProps(props)
return (
<div className={classnames('layout_footer', globalProps(props), className)}>
<div
className={classnames('layout_footer', globalProps(props), className)}
style={dynamicInlineProps}
>
{children}
</div>
)
Expand Down

0 comments on commit 8543aa2

Please sign in to comment.