Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TMC-1657): handle FloatingDrawer overflow #5475

Merged
merged 3 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shy-coats-invite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@talend/design-system': patch
---

TMC-1657 - Handle FloatingDrawer overflow
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
height: 100%;
background: tokens.$coral-color-neutral-background;
display: flex;
flex-flow: column;
justify-content: stretch;
align-items: stretch;
flex-wrap: nowrap;

.header {
flex-grow: 0;
Expand All @@ -20,7 +24,7 @@
flex-shrink: 1;
flex-basis: 0;
overflow: auto;

flex-flow: column;
display: flex;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { forwardRef } from 'react';
import type { Ref, ReactNode } from 'react';
import { StackVertical } from '../../Stack';
import type { ReactNode, Ref } from 'react';

import theme from './PrimitiveDrawer.module.scss';

Expand All @@ -13,11 +12,9 @@ export type DrawerProps = {
export const PrimitiveDrawer = forwardRef(
({ header, children, footer }: DrawerProps, ref: Ref<HTMLDivElement>) => (
<div className={theme.drawer} ref={ref}>
<StackVertical gap={0} align="stretch" justify="stretch">
{header && <div className={theme.header}>{header}</div>}
<div className={theme.body}>{children}</div>
{footer && <div className={theme.footer}>{footer}</div>}
</StackVertical>
{header && <div className={theme.header}>{header}</div>}
<div className={theme.body}>{children}</div>
{footer && <div className={theme.footer}>{footer}</div>}
</div>
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@ exports[`FloatingDrawer should render a11y html 1`] = `
class="theme-drawer"
>
<div
class="theme-stack theme-justify-stretch theme-align-stretch theme-nowrap theme-column theme-block theme-gap-x-0 theme-gap-y-0"
class="theme-body"
>
<div
class="theme-body"
>
<p>
content of the drawer
</p>
</div>
<p>
content of the drawer
</p>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState } from 'react';
import { StoryFn } from '@storybook/react';
import { screen, userEvent } from '@storybook/testing-library';

import { ButtonPrimary, FloatingDrawer, FloatingDrawerProps } from '../../';
import { ButtonPrimary, FloatingDrawer, FloatingDrawerProps, InlineEditing } from '../../';
import { Area } from '../docs/Area';

export default {
Expand Down Expand Up @@ -55,6 +55,17 @@ const defaultProps = {
footer: <Area>Footer</Area>,
};

const overflowProps = {
...defaultProps,
children: (
<InlineEditing.Textarea
defaultValue="Haaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice text 😁

placeholder="Type something..."
label="Iniline edit that overflows"
/>
),
};

const playOpenDrawer = async () => {
const openButton = screen.getByRole('button');
await userEvent.click(openButton);
Expand All @@ -75,6 +86,17 @@ export const Simple: StoryFn<typeof FloatingDrawer> = (
);
Simple.args = defaultProps;

export const Overflow: StoryFn<typeof FloatingDrawer> = ({
disclosure,
visible,
...props
}: FloatingDrawerProps) => (
<FloatingDrawer.Container style={containerStyle}>
<FloatingDrawer {...props} visible />
</FloatingDrawer.Container>
);
Overflow.args = overflowProps;

export const WithDisclosure: StoryFn<typeof FloatingDrawer> = () => (
<FloatingDrawer.Container style={containerStyle}>
<FloatingDrawer
Expand Down
Loading