Skip to content

The open alternative to Salesforce, designed for AI.

Use Twenty UI components in presentation stories (#25976)

Raphaël Bosi62ce73755225
diff --git a/packages/twenty-ui/src/icon/components/__stories__/IconDictionary.stories.module.scss b/packages/twenty-ui/src/icon/components/__stories__/IconDictionary.stories.module.scss
index 9152d02fb07..955c55ef20e 100644
--- a/packages/twenty-ui/src/icon/components/__stories__/IconDictionary.stories.module.scss
+++ b/packages/twenty-ui/src/icon/components/__stories__/IconDictionary.stories.module.scss
@@ -14,16 +14,13 @@
}
.categoryTitle {
- align-items: center;
+ align-items: stretch;
background: var(--t-background-transparent-lighter);
border-bottom: 1px solid var(--t-border-color-light);
box-sizing: border-box;
- color: var(--t-font-color-secondary);
display: flex;
- font-size: 11px;
- font-weight: var(--t-font-weight-semi-bold);
height: 24px;
- line-height: normal;
+ justify-content: center;
margin: 0;
padding: var(--t-spacing-2);
}
diff --git a/packages/twenty-ui/src/icon/components/__stories__/IconDictionary.stories.tsx b/packages/twenty-ui/src/icon/components/__stories__/IconDictionary.stories.tsx
index bed9afde7a8..249e8de2071 100644
--- a/packages/twenty-ui/src/icon/components/__stories__/IconDictionary.stories.tsx
+++ b/packages/twenty-ui/src/icon/components/__stories__/IconDictionary.stories.tsx
@@ -7,6 +7,8 @@ import {
} from '@ui/icon/constants/TwentyIconDictionary';
import { type IconComponent } from '@ui/icon/types/IconComponent';
import { ComponentDecorator } from '@ui/testing/decorators/ComponentDecorator';
+import { H2Title } from '@ui/primitives/typography/H2Title/H2Title';
+import { Text } from '@ui/primitives/typography/Text/Text';
import styles from './IconDictionary.stories.module.scss';
@@ -19,7 +21,7 @@ const IconDictionary = () => (
<div className={styles.dictionary}>
{TWENTY_ICON_DICTIONARY_CATEGORIES.map((category) => (
<section className={styles.category} key={category.key}>
- <h2 className={styles.categoryTitle}>{category.label}</h2>
+ <H2Title className={styles.categoryTitle} title={category.label} />
{TWENTY_ICON_DICTIONARY.filter(
(entry) => entry.category === category.key,
).map((entry) => {
@@ -27,7 +29,7 @@ const IconDictionary = () => (
return (
<div className={styles.item} key={entry.key}>
- <span>{entry.label}</span>
+ <Text>{entry.label}</Text>
<Icon
aria-hidden
color="var(--t-font-color-light)"
diff --git a/packages/twenty-ui/src/primitives/data-display/Chip/__stories__/Chip.stories.tsx b/packages/twenty-ui/src/primitives/data-display/Chip/__stories__/Chip.stories.tsx
index 396c8b593b5..1d2198dde1c 100644
--- a/packages/twenty-ui/src/primitives/data-display/Chip/__stories__/Chip.stories.tsx
+++ b/packages/twenty-ui/src/primitives/data-display/Chip/__stories__/Chip.stories.tsx
@@ -2,6 +2,7 @@ import { expect, fn, userEvent, within } from 'storybook/test';
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { IconUser, IconX } from '@ui/icon';
import { Avatar } from '@ui/primitives/data-display/Avatar/Avatar';
+import { Button } from '@ui/primitives/input/Button/Button';
import {
A11Y_DEFER_COLOR_CONTRAST,
@@ -233,9 +234,7 @@ export const ContentAndSlots: Story = {
children: <strong>Rich content</strong>,
startElement: <IconUser />,
endElement: (
- <button type="button" onClick={fn()}>
- Remove
- </button>
+ <Button type="button" title="Remove" ariaLabel="Remove" onClick={fn()} />
),
endElementDivider: true,
},
diff --git a/packages/twenty-ui/src/primitives/feedback/Toast/__stories__/Toast.stories.tsx b/packages/twenty-ui/src/primitives/feedback/Toast/__stories__/Toast.stories.tsx
index 88c205a6c08..bcfb0257dbc 100644
--- a/packages/twenty-ui/src/primitives/feedback/Toast/__stories__/Toast.stories.tsx
+++ b/packages/twenty-ui/src/primitives/feedback/Toast/__stories__/Toast.stories.tsx
@@ -3,7 +3,9 @@ import { useState } from 'react';
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
import { IconBell } from '@ui/icon';
+import { Button } from '@ui/primitives/input/Button/Button';
import { LightButton } from '@ui/primitives/input/LightButton/LightButton';
+import { ClickToActionLink } from '@ui/primitives/navigation/ClickToActionLink/ClickToActionLink';
import {
A11Y_DEFER_COLOR_CONTRAST,
CatalogDecorator,
@@ -74,7 +76,10 @@ export const CustomIconAndLink: Story = {
...Default,
args: { icon: <IconBell size={16} />, onClick: fn() },
render: (args) => (
- <Toast {...args} action={<a href="#record">View record</a>} />
+ <Toast
+ {...args}
+ action={<ClickToActionLink href="#record">View record</ClickToActionLink>}
+ />
),
play: async ({ canvasElement, args }) => {
const canvas = within(canvasElement);
@@ -101,9 +106,12 @@ const DismissibleToast = ({ onClose, ...props }: ToastProps) => {
return (
<>
- <button type="button" onClick={() => setIsOpen(true)}>
- Show notification
- </button>
+ <Button
+ type="button"
+ title="Show notification"
+ ariaLabel="Show notification"
+ onClick={() => setIsOpen(true)}
+ />
{isOpen && (
<Toast
{...props}
diff --git a/packages/twenty-ui/src/primitives/input/Checkbox/__stories__/Checkbox.stories.tsx b/packages/twenty-ui/src/primitives/input/Checkbox/__stories__/Checkbox.stories.tsx
index 0dc27429ca1..62a01631cab 100644
--- a/packages/twenty-ui/src/primitives/input/Checkbox/__stories__/Checkbox.stories.tsx
+++ b/packages/twenty-ui/src/primitives/input/Checkbox/__stories__/Checkbox.stories.tsx
@@ -3,6 +3,7 @@ import { useState } from 'react';
import { expect, fn, userEvent, within } from 'storybook/test';
import { Checkbox } from '@ui/primitives/input/Checkbox/Checkbox';
+import { Button } from '@ui/primitives/input/Button/Button';
import { type CheckboxColor } from '@ui/primitives/input/Checkbox/types/CheckboxColor';
import { type CheckboxProps } from '@ui/primitives/input/Checkbox/types/CheckboxProps';
import { type CheckboxSize } from '@ui/primitives/input/Checkbox/types/CheckboxSize';
@@ -27,9 +28,12 @@ const ControlledExample = (props: CheckboxProps) => {
return (
<>
<Checkbox {...props} checked={checked} />
- <button type="button" onClick={() => setChecked(true)}>
- Apply selection
- </button>
+ <Button
+ type="button"
+ title="Apply selection"
+ ariaLabel="Apply selection"
+ onClick={() => setChecked(true)}
+ />
</>
);
};
diff --git a/packages/twenty-ui/src/primitives/layout/AnimatedExpandableContainer/__stories__/AnimatedExpandableContainer.stories.module.scss b/packages/twenty-ui/src/primitives/layout/AnimatedExpandableContainer/__stories__/AnimatedExpandableContainer.stories.module.scss
index 37fa7b83dd7..ee8c41a0073 100644
--- a/packages/twenty-ui/src/primitives/layout/AnimatedExpandableContainer/__stories__/AnimatedExpandableContainer.stories.module.scss
+++ b/packages/twenty-ui/src/primitives/layout/AnimatedExpandableContainer/__stories__/AnimatedExpandableContainer.stories.module.scss
@@ -1,15 +1,5 @@
.button {
- padding: var(--t-spacing-2) var(--t-spacing-4);
- background-color: var(--t-color-blue10);
- color: var(--t-font-color-primary);
- border: none;
- border-radius: var(--t-spacing-1);
- cursor: pointer;
margin-bottom: var(--t-spacing-3);
-
- &:hover {
- background-color: var(--t-color-blue8);
- }
}
.buttonWrapper {
diff --git a/packages/twenty-ui/src/primitives/layout/AnimatedExpandableContainer/__stories__/AnimatedExpandableContainer.stories.tsx b/packages/twenty-ui/src/primitives/layout/AnimatedExpandableContainer/__stories__/AnimatedExpandableContainer.stories.tsx
index df65350fc1f..9ee2b5e78bc 100644
--- a/packages/twenty-ui/src/primitives/layout/AnimatedExpandableContainer/__stories__/AnimatedExpandableContainer.stories.tsx
+++ b/packages/twenty-ui/src/primitives/layout/AnimatedExpandableContainer/__stories__/AnimatedExpandableContainer.stories.tsx
@@ -3,6 +3,8 @@ import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';
import { clsx } from 'clsx';
import { useState } from 'react';
import { AnimatedExpandableContainer } from '@ui/primitives/layout/AnimatedExpandableContainer/AnimatedExpandableContainer';
+import { Button } from '@ui/primitives/input/Button/Button';
+import { Text } from '@ui/primitives/typography/Text/Text';
import styles from './AnimatedExpandableContainer.stories.module.scss';
@@ -33,12 +35,13 @@ const AnimatedExpandableContainerWithButton = ({
: styles.buttonWrapperHeight,
)}
>
- <button
+ <Button
+ type="button"
className={styles.button}
+ title={isExpanded ? 'Collapse' : 'Expand'}
+ ariaLabel={isExpanded ? 'Collapse' : 'Expand'}
onClick={() => setIsExpanded(!isExpanded)}
- >
- {isExpanded ? 'Collapse' : 'Expand'}
- </button>
+ />
<AnimatedExpandableContainer
isExpanded={isExpanded}
dimension={args.dimension}
@@ -55,18 +58,18 @@ const AnimatedExpandableContainerWithButton = ({
args.dimension === 'width' && styles.contentFixedWidth,
)}
>
- <p>
+ <Text render={<p />}>
This is some content inside the AnimatedExpandableContainer. It
will animate smoothly when expanding or collapsing.
- </p>
- <p>
+ </Text>
+ <Text render={<p />}>
You can control the animation duration, dimension, and mode
through the Storybook controls.
- </p>
- <p>
+ </Text>
+ <Text render={<p />}>
Try different combinations to see how the container behaves with
different settings!
- </p>
+ </Text>
</div>
</div>
</AnimatedExpandableContainer>
diff --git a/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.module.scss b/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.module.scss
index 953fb6c6cb1..60139a632bc 100644
--- a/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.module.scss
+++ b/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.module.scss
@@ -1,6 +1,3 @@
.title {
- align-items: center;
- color: var(--t-font-color-tertiary);
- font-size: 12px;
- margin-bottom: 8px;
+ margin-bottom: var(--t-spacing-2);
}
diff --git a/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.tsx b/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.tsx
index 26f351198aa..a2c89753b1d 100644
--- a/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.tsx
+++ b/packages/twenty-ui/src/primitives/navigation/MenuPicker/__stories__/MenuPicker.stories.tsx
@@ -4,6 +4,7 @@ import { TooltipDelay } from '@ui/primitives/surfaces';
import { MenuPicker } from '@ui/primitives/navigation/MenuPicker/MenuPicker';
import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';
import { type ReactNode } from 'react';
+import { H3Title } from '@ui/primitives/typography/H3Title/H3Title';
import styles from './MenuPicker.stories.module.scss';
@@ -54,7 +55,7 @@ export const WithoutLabel: Story = {
};
const SectionTitle = ({ children }: { children?: ReactNode }) => {
- return <h4 className={styles.title}>{children}</h4>;
+ return <H3Title className={styles.title} title={children} />;
};
export const AllStates: Story = {
diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.module.scss b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.module.scss
index d94d25224fa..a4d3c14a04a 100644
--- a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.module.scss
+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.module.scss
@@ -1,11 +1,3 @@
.panel {
padding: var(--t-spacing-4);
}
-
-.count {
- background: var(--t-background-tertiary);
- border-radius: var(--t-border-radius-sm);
- color: var(--t-font-color-secondary);
- font-size: var(--t-font-size-sm);
- padding-inline: var(--t-spacing-1);
-}
diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.module.scss.d.ts b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.module.scss.d.ts
index 0bd3d6aa971..25ca51db313 100644
--- a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.module.scss.d.ts
+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.module.scss.d.ts
@@ -1,5 +1,4 @@
declare const classNames: {
readonly panel: 'panel';
- readonly count: 'count';
};
export default classNames;
diff --git a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx
index 331965fad3c..15860904042 100644
--- a/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx
+++ b/packages/twenty-ui/src/primitives/navigation/Tabs/__stories__/Tabs.stories.tsx
@@ -3,7 +3,9 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
import { useState } from 'react';
import { expect, userEvent, within } from 'storybook/test';
+import { NotificationCounter } from '@ui/primitives/data-display/NotificationCounter/NotificationCounter';
import { IconInfoCircle } from '@ui/icon';
+import { Input } from '@ui/primitives/input/Input/Input';
import {
A11Y_DEFER_COLOR_CONTRAST,
CatalogDecorator,
@@ -44,7 +46,7 @@ const TabsExample = ({
keepMounted={keepMounted}
>
{keepMounted ? (
- <input aria-label="Draft note" placeholder="Write a note" />
+ <Input aria-label="Draft note" placeholder="Write a note" />
) : (
'Record overview'
)}
@@ -141,7 +143,7 @@ export const WithIconAndBadge: Story = {
parameters: { container: { width: 360 } },
args: {
startIcon: <IconInfoCircle />,
- badge: <span className={styles.count}>3</span>,
+ badge: <NotificationCounter count={3} variant="secondary" />,
},
};
@@ -223,7 +225,9 @@ const TABS_CATALOG_CONTENT_PROPS: Record<
> = {
plain: {},
icon: { startIcon: <IconInfoCircle /> },
- badge: { badge: <span className={styles.count}>3</span> },
+ badge: {
+ badge: <NotificationCounter count={3} variant="secondary" />,
+ },
};
export const Catalog: CatalogStory<Story, typeof Tabs.Tab> = {
diff --git a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__stories__/Tooltip.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__stories__/Tooltip.stories.tsx
index caf8301d7a8..957d7e369be 100644
--- a/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__stories__/Tooltip.stories.tsx
+++ b/packages/twenty-ui/src/primitives/surfaces/AppTooltip/__stories__/Tooltip.stories.tsx
@@ -2,6 +2,8 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
import { IconInfoCircle } from '@ui/icon';
+import { Button } from '@ui/primitives/input/Button/Button';
+import { Text } from '@ui/primitives/typography/Text/Text';
import {
A11Y_DEFER_COLOR_CONTRAST,
CatalogDecorator,
@@ -16,9 +18,9 @@ import {
} from '../AppTooltip';
const CUSTOM_CONTENT = (
- <span>
+ <Text render={<span />}>
<strong>Custom</strong> formatted content
- </span>
+ </Text>
);
const findTooltip = async (canvasElement: HTMLElement) => {
@@ -56,9 +58,12 @@ const meta: Meta<typeof Tooltip> = {
},
render: (args) => (
<>
- <button type="button" id={args.anchorSelect?.slice(1)}>
- Hover or focus me
- </button>
+ <Button
+ type="button"
+ id={args.anchorSelect?.slice(1)}
+ title="Hover or focus me"
+ ariaLabel="Hover or focus me"
+ />
<Tooltip {...args} />
</>
),
@@ -217,9 +222,12 @@ export const InteractiveCustomContent: Story = {
description: undefined,
interactive: true,
children: (
- <button type="button" onClick={onCustomActionClick}>
- Show more
- </button>
+ <Button
+ type="button"
+ title="Show more"
+ ariaLabel="Show more"
+ onClick={onCustomActionClick}
+ />
),
},
decorators: [ComponentDecorator],
diff --git a/packages/twenty-ui/src/primitives/surfaces/Popover/__stories__/Popover.stories.tsx b/packages/twenty-ui/src/primitives/surfaces/Popover/__stories__/Popover.stories.tsx
index fe32ef7c0fd..cc9fc8a3643 100644
--- a/packages/twenty-ui/src/primitives/surfaces/Popover/__stories__/Popover.stories.tsx
+++ b/packages/twenty-ui/src/primitives/surfaces/Popover/__stories__/Popover.stories.tsx
@@ -3,6 +3,7 @@ import { type CSSProperties, useState } from 'react';
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
import { IconX } from '@ui/icon';
+import { Button } from '@ui/primitives/input/Button/Button';
import {
A11Y_DEFER_COLOR_CONTRAST,
CatalogDecorator,
@@ -46,13 +47,13 @@ const PopoverStory = ({
>
<Popover.Title>Details</Popover.Title>
<Popover.Description>More information</Popover.Description>
- <button type="button">First action</button>
+ <Button type="button" title="First action" ariaLabel="First action" />
<Popover.Close aria-label="Close" style={{ alignSelf: 'flex-start' }}>
<IconX size={16} />
</Popover.Close>
</Popover.Popup>
</Popover.Root>
- <button type="button">Outside</button>
+ <Button type="button" title="Outside" ariaLabel="Outside" />
</>
);
@@ -174,9 +175,12 @@ const ArrowPopoverStory = (props: PopoverStoryProps) => {
return (
<div style={{ paddingTop: 160, paddingInlineStart: 160 }}>
<PopoverStory {...props} open arrow={arrow} />
- <button type="button" onClick={() => setArrow(!arrow)}>
- Toggle arrow
- </button>
+ <Button
+ type="button"
+ title="Toggle arrow"
+ ariaLabel="Toggle arrow"
+ onClick={() => setArrow(!arrow)}
+ />
</div>
);
};
@@ -363,9 +367,12 @@ const ControlledPopoverStory = (props: PopoverStoryProps) => {
return (
<>
<PopoverStory {...props} open={open} />
- <button type="button" onClick={() => setOpen(false)}>
- Apply closed state
- </button>
+ <Button
+ type="button"
+ title="Apply closed state"
+ ariaLabel="Apply closed state"
+ onClick={() => setOpen(false)}
+ />
</>
);
};