The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Let InlineBanner fill its container (#28315)
Raphaël Bosi53263cd99beb
diff --git a/packages/twenty-docs/snippets/ui/generated/components/feedback/inline-banner.mdx b/packages/twenty-docs/snippets/ui/generated/components/feedback/inline-banner.mdxindex 4dfc5f48765..7f0f303e10a 100644--- a/packages/twenty-docs/snippets/ui/generated/components/feedback/inline-banner.mdx+++ b/packages/twenty-docs/snippets/ui/generated/components/feedback/inline-banner.mdx@@ -31,6 +31,10 @@Removes the standard bottom margin. Compact layouts have no bottom margin.</ParamField>+<ParamField body="fullWidth" type="boolean" default="false">+ Fills the available parent width, including padding and borders, and removes the compact layout's 512px maximum. Defaults to false; standard layout already fills its parent.+</ParamField>+<ParamField body="icon" type="ReactNode" default="decorative information icon">Leading ReactNode. Defaults to a decorative information icon. Pass null to omit it.</ParamField>diff --git a/packages/twenty-docs/ui/components/feedback/inline-banner.mdx b/packages/twenty-docs/ui/components/feedback/inline-banner.mdxindex 5c6c53bdee3..b4a697d6608 100644--- a/packages/twenty-docs/ui/components/feedback/inline-banner.mdx+++ b/packages/twenty-docs/ui/components/feedback/inline-banner.mdx@@ -35,7 +35,7 @@ export const ModelsBanner = ({ onConfigure }: { onConfigure: () => void }) => (The `standard` layout fills the available width. Plain string children truncate, with keyboard focus, pointer hover or touch revealing the full string in a tooltip. Rich node children render directly, so embedded links and controls retain their own semantics. Compose explicit typography when rich content needs truncation.-Use `layout="compact"` for wrapping content, closer spacing and a maximum content width of 512px. It has no bottom margin. Layout is independent of `solid` or `soft` appearance. `embedded` removes the standard layout's bottom margin.+Use `layout="compact"` for wrapping content, closer spacing and a maximum content width of 512px. Add `fullWidth` to remove that cap and fill the available parent width, including padding and borders. It defaults to `false` and does not change the standard layout, which already fills its parent. It has no bottom margin. Layout is independent of `solid` or `soft` appearance. `embedded` removes the standard layout's bottom margin.```tsximport { InlineBanner } from 'twenty-ui/components/feedback';diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-inline-banner.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-inline-banner.front-component.tsxindex d0844b13d0e..cd028dede23 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-inline-banner.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-inline-banner.front-component.tsx@@ -1,5 +1,5 @@import { Button } from 'twenty-ui/primitives/input';-import { createElement, useState } from 'react';+import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';import { defineFrontComponent } from 'twenty-sdk/define';import { InlineBanner } from 'twenty-ui/components/feedback';@@ -22,12 +22,14 @@ const InlineBannerExample = () => {aria-label="Inline sync result"className="custom-inline-banner"style={{ marginTop: 7 }}- render={(props, state) =>- createElement('section', {- ...props,- 'data-render-status': state.status,- })- }+ fullWidth+ render={(props, state) => (+ <section+ // oxlint-disable-next-line react/jsx-props-no-spreading+ {...props}+ data-render-status={state.status}+ />+ )}ref={(element) => {if (isDefined(element)) element.dataset.refTag = element.tagName;}}diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/inlineBannerTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/inlineBannerTest.tsindex 7b0def09ec9..e6ea24e851f 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/inlineBannerTest.ts+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/inlineBannerTest.ts@@ -21,6 +21,8 @@ export const inlineBannerTest: TwentyUiGalleryPlayFunction = async ({await expect(banner).toHaveAttribute('aria-live', 'polite');await expect(banner).toHaveClass('custom-inline-banner');await expect(banner).toHaveStyle({ marginTop: '7px' });+ await expect(getComputedStyle(banner).maxWidth).toBe('none');+ await expect(getComputedStyle(banner).boxSizing).toBe('border-box');const button = canvas.getByRole('button', { name: 'Retry sync' });await expect(getComputedStyle(button).color).toBe(diff --git a/packages/twenty-front/src/modules/settings/legal/components/DpaNotice.tsx b/packages/twenty-front/src/modules/settings/legal/components/DpaNotice.tsxindex bb0a5a09da2..c5d0ae266fa 100644--- a/packages/twenty-front/src/modules/settings/legal/components/DpaNotice.tsx+++ b/packages/twenty-front/src/modules/settings/legal/components/DpaNotice.tsx@@ -1,20 +1,11 @@-import { styled } from '@linaria/react';import { InlineBanner } from 'twenty-ui/components/feedback';-const StyledFullWidthBanner = styled.div`- & > * {- max-width: 100%;- }-`;-type DpaNoticeProps = {text: string;};export const DpaNotice = ({ text }: DpaNoticeProps) => (- <StyledFullWidthBanner>- <InlineBanner layout="compact" status="warning">- {text}- </InlineBanner>- </StyledFullWidthBanner>+ <InlineBanner layout="compact" status="warning" fullWidth>+ {text}+ </InlineBanner>);diff --git a/packages/twenty-ui/docs/components.ts b/packages/twenty-ui/docs/components.tsindex fc62aeae62c..a1fb4fd64a9 100644--- a/packages/twenty-ui/docs/components.ts+++ b/packages/twenty-ui/docs/components.ts@@ -953,6 +953,7 @@ export const DOCUMENTED_COMPONENTS = [variant: 'soft',layout: 'standard',embedded: 'false',+ fullWidth: 'false',icon: 'decorative information icon',},},diff --git a/packages/twenty-ui/docs/inlineBannerPropDescriptions.ts b/packages/twenty-ui/docs/inlineBannerPropDescriptions.tsindex 3038e185887..841441bf781 100644--- a/packages/twenty-ui/docs/inlineBannerPropDescriptions.ts+++ b/packages/twenty-ui/docs/inlineBannerPropDescriptions.ts@@ -12,6 +12,8 @@ export const INLINE_BANNER_PROP_DESCRIPTIONS = {'Gray, blue, green, orange or red palette override. An omitted color follows status.',layout:'Standard full-width layout or compact wrapping layout with a 512px maximum content width. Defaults to standard.',+ fullWidth:+ "Fills the available parent width, including padding and borders, and removes the compact layout's 512px maximum. Defaults to false; standard layout already fills its parent.",embedded:'Removes the standard bottom margin. Compact layouts have no bottom margin.',icon: 'Leading ReactNode. Defaults to a decorative information icon. Pass null to omit it.',diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex 669a0aa26c8..ab9970bc2a7 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -14010,6 +14010,13 @@"defaultValue": "false","description": "Removes the standard bottom margin. Compact layouts have no bottom margin."},+ {+ "name": "fullWidth",+ "type": "boolean",+ "required": false,+ "defaultValue": "false",+ "description": "Fills the available parent width, including padding and borders, and removes the compact layout's 512px maximum. Defaults to false; standard layout already fills its parent."+ },{"name": "icon","type": "ReactNode",diff --git a/packages/twenty-ui/src/components/feedback/InlineBanner/InlineBanner.module.scss b/packages/twenty-ui/src/components/feedback/InlineBanner/InlineBanner.module.scssindex 0c0bdaf1726..be316254a4e 100644--- a/packages/twenty-ui/src/components/feedback/InlineBanner/InlineBanner.module.scss+++ b/packages/twenty-ui/src/components/feedback/InlineBanner/InlineBanner.module.scss@@ -60,3 +60,9 @@color: var(--t-color-red);}}++.fullWidth {+ box-sizing: border-box;+ max-width: none;+ width: 100%;+}diff --git a/packages/twenty-ui/src/components/feedback/InlineBanner/InlineBanner.module.scss.d.ts b/packages/twenty-ui/src/components/feedback/InlineBanner/InlineBanner.module.scss.d.tsindex f211f2a4a47..e1453a628da 100644--- a/packages/twenty-ui/src/components/feedback/InlineBanner/InlineBanner.module.scss.d.ts+++ b/packages/twenty-ui/src/components/feedback/InlineBanner/InlineBanner.module.scss.d.ts@@ -5,5 +5,6 @@ declare const classNames: {readonly icon: 'icon';readonly bannerText: 'bannerText';readonly compact: 'compact';+ readonly fullWidth: 'fullWidth';};export default classNames;diff --git a/packages/twenty-ui/src/components/feedback/InlineBanner/__stories__/InlineBanner.stories.tsx b/packages/twenty-ui/src/components/feedback/InlineBanner/__stories__/InlineBanner.stories.tsxindex b79024a8437..732e1774308 100644--- a/packages/twenty-ui/src/components/feedback/InlineBanner/__stories__/InlineBanner.stories.tsx+++ b/packages/twenty-ui/src/components/feedback/InlineBanner/__stories__/InlineBanner.stories.tsx@@ -214,6 +214,39 @@ export const CompactLink: Story = {},};+export const FullWidth: Story = {+ args: {+ ...CompactLink.args,+ fullWidth: true,+ role: 'status',+ 'aria-label': 'Full-width connection notice',+ },+ play: async ({ canvasElement }) => {+ const banner = within(canvasElement).getByRole('status', {+ name: 'Full-width connection notice',+ });++ await expect(getComputedStyle(banner).maxWidth).toBe('none');+ await expect(getComputedStyle(banner).boxSizing).toBe('border-box');+ await expect(banner.getBoundingClientRect().width).toBeGreaterThan(512);+ await expect(banner.scrollWidth).toBeLessThanOrEqual(banner.clientWidth);+ await expect(banner).not.toHaveAttribute('fullWidth');+ },+};++export const FullWidthNarrow: Story = {+ ...FullWidth,+ parameters: { container: { width: 240 } },+ play: async ({ canvasElement }) => {+ const banner = within(canvasElement).getByRole('status', {+ name: 'Full-width connection notice',+ });++ await expect(banner.getBoundingClientRect().width).toBeLessThanOrEqual(240);+ await expect(banner.scrollWidth).toBeLessThanOrEqual(banner.clientWidth);+ },+};+export const CompactDanger: Story = {args: {layout: 'compact',diff --git a/packages/twenty-ui/src/components/feedback/InlineBanner/internal/InlineBannerComponent.tsx b/packages/twenty-ui/src/components/feedback/InlineBanner/internal/InlineBannerComponent.tsxindex 4030bc65534..a9d9cb0818d 100644--- a/packages/twenty-ui/src/components/feedback/InlineBanner/internal/InlineBannerComponent.tsx+++ b/packages/twenty-ui/src/components/feedback/InlineBanner/internal/InlineBannerComponent.tsx@@ -14,6 +14,7 @@ export const InlineBannerComponent = ({layout = 'standard',variant = 'soft',embedded = false,+ fullWidth = false,icon = <IconInfoCircle aria-hidden="true" />,className,...props@@ -28,6 +29,7 @@ export const InlineBannerComponent = ({styles.banner,isCompact && styles.compact,embedded && styles.embedded,+ fullWidth && styles.fullWidth,className,)}variant={variant}diff --git a/packages/twenty-ui/src/components/feedback/InlineBanner/types/InlineBannerProps.ts b/packages/twenty-ui/src/components/feedback/InlineBanner/types/InlineBannerProps.tsindex f3f0184c2e7..0cf46aa511d 100644--- a/packages/twenty-ui/src/components/feedback/InlineBanner/types/InlineBannerProps.ts+++ b/packages/twenty-ui/src/components/feedback/InlineBanner/types/InlineBannerProps.ts@@ -5,4 +5,5 @@ import { type InlineBannerLayout } from './InlineBannerLayout';export type InlineBannerProps = BannerProps & {layout?: InlineBannerLayout;embedded?: boolean;+ fullWidth?: boolean;};