The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Add larger Heading sizes (#28314)
Raphaël Bosi16bf7cb1b67c
diff --git a/packages/twenty-docs/snippets/ui/generated/components/layout/section.mdx b/packages/twenty-docs/snippets/ui/generated/components/layout/section.mdxindex 3d5c1de5042..8c82f92b556 100644--- a/packages/twenty-docs/snippets/ui/generated/components/layout/section.mdx+++ b/packages/twenty-docs/snippets/ui/generated/components/layout/section.mdx@@ -65,8 +65,8 @@Accepts a `ReactElement` or a function that returns the element to render.</ParamField>-<ParamField body="Header.size" type=""lg" | "md" | "sm" | "xs"" default="md">- Visual font size, independent of the heading level. Defaults to `md`.+<ParamField body="Header.size" type=""lg" | "md" | "sm" | "xl" | "xs" | "xxl"" default="md">+ Visual font size from `xs` through `xxl`, independent of the heading level. Uses the matching font token. Defaults to `md`.</ParamField><ParamField body="Header.title" type="ReactNode" required>diff --git a/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdx b/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdxindex 3dcaf275351..76089c4465b 100644--- a/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdx+++ b/packages/twenty-docs/snippets/ui/generated/surfaces/dialog.mdx@@ -256,7 +256,7 @@Accepts a `ReactElement` or a function that returns the element to render.</ParamField>-<ParamField body="Title.size" type=""lg" | "md" | "sm" | "xs"" default="lg">+<ParamField body="Title.size" type=""lg" | "md" | "sm" | "xl" | "xs" | "xxl"" default="lg">Visual font size, independent of the heading level. Defaults to `lg`.</ParamField>diff --git a/packages/twenty-docs/snippets/ui/generated/typography/heading.mdx b/packages/twenty-docs/snippets/ui/generated/typography/heading.mdxindex b66c45396ac..901315b9805 100644--- a/packages/twenty-docs/snippets/ui/generated/typography/heading.mdx+++ b/packages/twenty-docs/snippets/ui/generated/typography/heading.mdx@@ -26,6 +26,6 @@Accepts a `ReactElement` or a function that returns the element to render.</ParamField>-<ParamField body="size" type=""lg" | "md" | "sm" | "xs"" default="md">- Visual font size, independent of the heading level. Defaults to `md`.+<ParamField body="size" type=""lg" | "md" | "sm" | "xl" | "xs" | "xxl"" default="md">+ Visual font size from `xs` through `xxl`, independent of the heading level. Uses the matching font token. Defaults to `md`.</ParamField>diff --git a/packages/twenty-docs/ui/primitives/typography/heading.mdx b/packages/twenty-docs/ui/primitives/typography/heading.mdxindex 9cea756005a..9404bdb2a48 100644--- a/packages/twenty-docs/ui/primitives/typography/heading.mdx+++ b/packages/twenty-docs/ui/primitives/typography/heading.mdx@@ -24,14 +24,14 @@ import { Heading } from 'twenty-ui/primitives/typography';export const WorkspaceTitle = () => <Heading>Workspace settings</Heading>;```-Sizes `xs`, `sm`, `md`, and `lg` use the matching font tokens. Headings have no outer margin; their surrounding layout owns spacing.+Sizes `xs`, `sm`, `md`, `lg`, `xl`, and `xxl` use the matching font tokens. The larger sizes use `1.54rem` and `1.85rem`, respectively. All sizes keep semibold weight and a `1.1` line height. `Section.Header` and `Dialog.Title` accept the same size values. Headings have no outer margin; their surrounding layout owns spacing.## Color and composition<StoryEmbedstoryId="ui-typography-heading--catalog"title="Heading sizes and colors"- height={320}+ height={480}/>Use `color="secondary"` for less prominent headings. `tertiary` is also available, but its contrast depends on the font size, theme, and background. Check readability when using it.diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-typography-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-typography-gallery.front-component.tsxindex 4c1acc6babe..c0cf349682d 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-typography-gallery.front-component.tsx+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-typography-gallery.front-component.tsx@@ -36,7 +36,7 @@ const TYPOGRAPHY_ENTRIES: GalleryEntry[] = [{name: 'Heading',node: (- <Heading level={1} size="lg">+ <Heading level={1} size="xxl">Heading 1</Heading>),@@ -48,7 +48,7 @@ const TYPOGRAPHY_ENTRIES: GalleryEntry[] = [{name: 'HeadingLevel',node: (- <Heading level={3} size="sm">+ <Heading level={3} size="xl">Heading 3</Heading>),diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/typographyTest.ts b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/typographyTest.tsindex 8d3e4690043..5528040f2c0 100644--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/typographyTest.ts+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/utils/typographyTest.ts@@ -26,10 +26,10 @@ export const typographyTest: TwentyUiGalleryPlayFunction = async (context) => {await expect(canvas.getByRole('heading', { level: 1, name: 'Heading 1' }),- ).toHaveAttribute('data-size', 'lg');+ ).toHaveAttribute('data-size', 'xxl');await expect(canvas.getByRole('heading', { level: 3, name: 'Heading 3' }),- ).toHaveAttribute('data-size', 'sm');+ ).toHaveAttribute('data-size', 'xl');await expect(canvas.getByRole('heading', { level: 2, name: 'Workspace preferences' }),).toHaveAccessibleDescription('Manage the settings for your workspace.');diff --git a/packages/twenty-front/src/modules/page-layout/widgets/graph/graph-widget-aggregate-chart/components/GraphWidgetAggregateChart.tsx b/packages/twenty-front/src/modules/page-layout/widgets/graph/graph-widget-aggregate-chart/components/GraphWidgetAggregateChart.tsxindex d40baa6e981..949c6189941 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/graph/graph-widget-aggregate-chart/components/GraphWidgetAggregateChart.tsx+++ b/packages/twenty-front/src/modules/page-layout/widgets/graph/graph-widget-aggregate-chart/components/GraphWidgetAggregateChart.tsx@@ -32,13 +32,6 @@ const StyledTrendIconContainer = styled.div`justify-content: center;`;-const StyledHeadingWrapper = styled.div`- > h2 {- font-size: ${themeCssVariables.font.size.xxl};- margin: 0;- }-`;-export const GraphWidgetAggregateChart = ({value,trendPercentage,@@ -55,11 +48,9 @@ export const GraphWidgetAggregateChart = ({return (<StyledContainer>- <StyledHeadingWrapper>- <Heading level={2} size="lg">- {displayValue}- </Heading>- </StyledHeadingWrapper>+ <Heading level={2} size="xxl">+ {displayValue}+ </Heading>{isDefined(trendPercentage) && (<StyledTrendIconContainer><StyledTrendPercentageValue>diff --git a/packages/twenty-front/src/modules/settings/unsubscribers/components/SettingsUnsubscribePreview.tsx b/packages/twenty-front/src/modules/settings/unsubscribers/components/SettingsUnsubscribePreview.tsxindex 2ac4b944cbf..b6b68caff60 100644--- a/packages/twenty-front/src/modules/settings/unsubscribers/components/SettingsUnsubscribePreview.tsx+++ b/packages/twenty-front/src/modules/settings/unsubscribers/components/SettingsUnsubscribePreview.tsx@@ -32,12 +32,9 @@ const StyledCard = styled(Card.Root)`padding: ${themeCssVariables.spacing[8]};`;-const StyledHeader = styled.div`+const StyledHeader = styled(Section.Header)`+ align-items: center;text-align: center;-- h2 {- font-size: 20px;- }`;const StyledTopics = styled.div`@@ -93,12 +90,11 @@ export const SettingsUnsubscribePreview = () => {fullWidthbackgroundColor={themeCssVariables.background.primary}>- <StyledHeader>- <Section.Header- title={t`Do you want to unsubscribe?`}- description={t`Confirm your preferences:`}- />- </StyledHeader>+ <StyledHeader+ size="xl"+ title={t`Do you want to unsubscribe?`}+ description={t`Confirm your preferences:`}+ />{hasPublicTopics && (<StyledTopics>{publicTopics.map((topic) => (diff --git a/packages/twenty-ui/docs/headingPropDescriptions.ts b/packages/twenty-ui/docs/headingPropDescriptions.tsindex ea6528ac9a1..ea1cebcadfa 100644--- a/packages/twenty-ui/docs/headingPropDescriptions.ts+++ b/packages/twenty-ui/docs/headingPropDescriptions.ts@@ -3,6 +3,6 @@ import { type HeadingProps } from '../src/primitives/typography/Heading/types/Heexport const HEADING_PROP_DESCRIPTIONS = {level:'Semantic heading level, from `h1` through `h6`. Does not change the visual size. Defaults to `2`.',- size: 'Visual font size, independent of the heading level. Defaults to `md`.',+ size: 'Visual font size from `xs` through `xxl`, independent of the heading level. Uses the matching font token. Defaults to `md`.',color: 'Theme font color. Defaults to `primary`.',} satisfies Partial<Record<keyof HeadingProps, string>>;diff --git a/packages/twenty-ui/generated/components.docs.json b/packages/twenty-ui/generated/components.docs.jsonindex fee91f9f6aa..669a0aa26c8 100644--- a/packages/twenty-ui/generated/components.docs.json+++ b/packages/twenty-ui/generated/components.docs.json@@ -8594,7 +8594,7 @@},{"name": "size",- "type": "\"lg\" | \"md\" | \"sm\" | \"xs\"",+ "type": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\" | \"xxl\"","required": false,"defaultValue": "lg","description": "Visual font size, independent of the heading level. Defaults to `lg`."@@ -11247,10 +11247,10 @@},{"name": "size",- "type": "\"lg\" | \"md\" | \"sm\" | \"xs\"",+ "type": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\" | \"xxl\"","required": false,"defaultValue": "md",- "description": "Visual font size, independent of the heading level. Defaults to `md`."+ "description": "Visual font size from `xs` through `xxl`, independent of the heading level. Uses the matching font token. Defaults to `md`."}]},@@ -12988,10 +12988,10 @@},{"name": "size",- "type": "\"lg\" | \"md\" | \"sm\" | \"xs\"",+ "type": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\" | \"xxl\"","required": false,"defaultValue": "md",- "description": "Visual font size, independent of the heading level. Defaults to `md`."+ "description": "Visual font size from `xs` through `xxl`, independent of the heading level. Uses the matching font token. Defaults to `md`."},{"name": "title",diff --git a/packages/twenty-ui/src/components/layout/Section/__tests__/SectionHeader.test.tsx b/packages/twenty-ui/src/components/layout/Section/__tests__/SectionHeader.test.tsxindex ea68d22f89c..06c56e22210 100644--- a/packages/twenty-ui/src/components/layout/Section/__tests__/SectionHeader.test.tsx+++ b/packages/twenty-ui/src/components/layout/Section/__tests__/SectionHeader.test.tsx@@ -22,7 +22,7 @@ describe('Section.Header', () => {title="Workspace"description="Manage your team"level={3}- size="lg"+ size="xl"/>,);@@ -33,7 +33,7 @@ describe('Section.Header', () => {expect(screen.getAllByRole('heading')).toHaveLength(1);expect(heading).toHaveAccessibleDescription('Manage your team');- expect(heading).toHaveAttribute('data-size', 'lg');+ expect(heading).toHaveAttribute('data-size', 'xl');});it('accepts rich descriptions and omits their association when cleared', () => {diff --git a/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/DialogTitle.test.tsx b/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/DialogTitle.test.tsxindex d110ecdac46..f7967317ae7 100644--- a/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/DialogTitle.test.tsx+++ b/packages/twenty-ui/src/primitives/surfaces/Dialog/__tests__/DialogTitle.test.tsx@@ -29,7 +29,7 @@ it('labels the dialog and keeps the title level independent of its size', () =><Dialog.Backdrop /><Dialog.Viewport><Dialog.Popup initialFocus={false}>- <Dialog.Title level={3} size="sm">+ <Dialog.Title level={3} size="xxl">Grant credits</Dialog.Title></Dialog.Popup>@@ -44,7 +44,7 @@ it('labels the dialog and keeps the title level independent of its size', () =>level: 3,});- expect(heading).toHaveAttribute('data-size', 'sm');+ expect(heading).toHaveAttribute('data-size', 'xxl');expect(screen.getByRole('dialog', { name: 'Grant credits' })).toHaveAttribute('aria-labelledby',heading.id,diff --git a/packages/twenty-ui/src/primitives/typography/Heading/Heading.module.scss b/packages/twenty-ui/src/primitives/typography/Heading/Heading.module.scssindex bc66fd45bce..b3b65bdf669 100644--- a/packages/twenty-ui/src/primitives/typography/Heading/Heading.module.scss+++ b/packages/twenty-ui/src/primitives/typography/Heading/Heading.module.scss@@ -21,6 +21,14 @@font-size: var(--t-font-size-lg);}+ &:where([data-size='xl']) {+ font-size: var(--t-font-size-xl);+ }++ &:where([data-size='xxl']) {+ font-size: var(--t-font-size-xxl);+ }+&:where([data-color='primary']) {color: var(--t-font-color-primary);}diff --git a/packages/twenty-ui/src/primitives/typography/Heading/__stories__/Heading.stories.tsx b/packages/twenty-ui/src/primitives/typography/Heading/__stories__/Heading.stories.tsxindex 9e2fb0c1a68..e8324cc18c5 100644--- a/packages/twenty-ui/src/primitives/typography/Heading/__stories__/Heading.stories.tsx+++ b/packages/twenty-ui/src/primitives/typography/Heading/__stories__/Heading.stories.tsx@@ -34,7 +34,7 @@ export const SemanticLevel: Story = {},};-const HEADING_SIZES = ['xs', 'sm', 'md', 'lg'] as const;+const HEADING_SIZES = ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'] as const;const HEADING_COLORS = ['primary', 'secondary'] as const;export const Catalog: Story = {diff --git a/packages/twenty-ui/src/primitives/typography/Heading/types/HeadingProps.ts b/packages/twenty-ui/src/primitives/typography/Heading/types/HeadingProps.tsindex 3cf7f16d9cc..6fe3cd8fe42 100644--- a/packages/twenty-ui/src/primitives/typography/Heading/types/HeadingProps.ts+++ b/packages/twenty-ui/src/primitives/typography/Heading/types/HeadingProps.ts@@ -2,6 +2,6 @@ import { type useRender } from '@base-ui/react/use-render';export type HeadingProps = Omit<useRender.ComponentProps<'h2'>, 'color'> & {level?: 1 | 2 | 3 | 4 | 5 | 6;- size?: 'xs' | 'sm' | 'md' | 'lg';+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';color?: 'primary' | 'secondary' | 'tertiary';};