The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Give the gray soft Banner a visible tint (#28264)
Raphaël Bosi4574949185ca
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumn.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumn.tsxindex 093c159c2b5..236f4fa8702 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumn.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumn.tsx@@ -9,7 +9,6 @@ import { styled } from '@linaria/react';import { themeCssVariables } from 'twenty-ui/theme';import { t } from '@lingui/core/macro';import { useLingui } from '@lingui/react/macro';-import { useState } from 'react';import { isDefined } from 'twenty-shared/utils';import { Collapsible } from 'twenty-ui/primitives/layout';@@ -55,7 +54,6 @@ export const UnmatchColumn = ({onSubChange,}: UnmatchColumnProps) => {const { spreadsheetImportFields: fields } = useSpreadsheetImportInternal();- const [isExpanded, setIsExpanded] = useState(false);const column = columns[columnIndex];const isSelect = 'matchedOptions' in column;const { t } = useLingui();@@ -65,28 +63,24 @@ export const UnmatchColumn = ({if (!isSelect) return null;return (- <StyledContainer>+ <Collapsible.Root render={<StyledContainer />}><UnmatchColumnBannermessage={getExpandableContainerTitle(fields, column)}- buttonOnClick={() => setIsExpanded(!isExpanded)}- isExpanded={isExpanded}allMatched={allMatched}/>- <Collapsible.Root open={isExpanded}>- <Collapsible.Panel dimension="height" containAnimation>- <StyledContentWrapper>- {column.matchedOptions?.map((option) => (- <SubMatchingSelectRow- option={option}- column={column}- onSubChange={onSubChange}- key={option.entry}- placeholder={t`Select an option`}- />- ))}- </StyledContentWrapper>- </Collapsible.Panel>- </Collapsible.Root>- </StyledContainer>+ <Collapsible.Panel dimension="height" containAnimation>+ <StyledContentWrapper>+ {column.matchedOptions?.map((option) => (+ <SubMatchingSelectRow+ option={option}+ column={column}+ onSubChange={onSubChange}+ key={option.entry}+ placeholder={t`Select an option`}+ />+ ))}+ </StyledContentWrapper>+ </Collapsible.Panel>+ </Collapsible.Root>);};diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumnBanner.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumnBanner.tsxindex dc31b178df4..cfa822a9146 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumnBanner.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components/UnmatchColumnBanner.tsx@@ -1,92 +1,51 @@import { styled } from '@linaria/react';-import { isDefined } from 'twenty-shared/utils';-import { Banner } from 'twenty-ui/primitives/feedback';-import { IconChevronDown, IconInfoCircle } from 'twenty-ui/icon';-import { useTheme, themeCssVariables } from 'twenty-ui/theme';+import { InlineBanner } from 'twenty-ui/components/feedback';+import { IconChevronDown } from 'twenty-ui/icon';+import { Collapsible } from 'twenty-ui/primitives/layout';+import { themeCssVariables, useTheme } from 'twenty-ui/theme';-const StyledBannerContainer = styled.div<{ allMatched: boolean }>`- > div {- background: ${({ allMatched }) =>- allMatched- ? themeCssVariables.accent.secondary- : themeCssVariables.background.transparent.light};- border-radius: ${themeCssVariables.spacing[2]};- padding: ${themeCssVariables.spacing[2]} 10px;+const StyledTriggerButton = styled.button`+ align-items: center;+ display: flex;+ gap: ${themeCssVariables.spacing[2]};+ text-align: start;+ width: 100%;++ > svg {+ flex-shrink: 0;+ transition: transform+ calc(${themeCssVariables.animation.duration.normal} * 1s) ease;+ }++ &[data-panel-open] > svg {+ transform: rotate(180deg);}`;-const StyledText = styled.div<{ allMatched: boolean }>`- color: ${({ allMatched }) =>- allMatched- ? themeCssVariables.color.blue- : themeCssVariables.font.color.secondary};+const StyledText = styled.span`flex: 1;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;`;-const StyledIconChevronDownWrapper = styled.div<{- isExpanded: boolean;+type UnmatchColumnBannerProps = {+ message: string;allMatched: boolean;-}>`- align-items: center;- color: ${({ allMatched }) =>- allMatched- ? themeCssVariables.color.blue- : themeCssVariables.font.color.secondary};- cursor: pointer;- display: flex;- transform: ${({ isExpanded }) =>- isExpanded ? 'rotate(180deg)' : 'rotate(0deg)'};- transition: transform- calc(${themeCssVariables.animation.duration.normal} * 1s) ease;-`;--const StyledClickableContainer = styled.div`- align-items: center;- cursor: pointer;-- display: flex;- flex-direction: row;- justify-content: center;- width: 100%;-`;+};export const UnmatchColumnBanner = ({message,- isExpanded,- buttonOnClick,allMatched,-}: {- message: string;- isExpanded: boolean;- buttonOnClick?: () => void;- allMatched: boolean;-}) => {+}: UnmatchColumnBannerProps) => {const theme = useTheme();return (- <StyledBannerContainer allMatched={allMatched}>- <Banner>- <IconInfoCircle- color={allMatched ? theme.color.blue : theme.font.color.secondary}- size={theme.icon.size.md}- />- {isDefined(buttonOnClick) ? (- <StyledClickableContainer onClick={buttonOnClick}>- <StyledText allMatched={allMatched}>{message}</StyledText>- <StyledIconChevronDownWrapper- isExpanded={isExpanded}- allMatched={allMatched}- >- <IconChevronDown size={theme.icon.size.md} />- </StyledIconChevronDownWrapper>- </StyledClickableContainer>- ) : (- <StyledText allMatched={allMatched}>{message}</StyledText>- )}- </Banner>- </StyledBannerContainer>+ <InlineBanner embedded color={allMatched ? 'blue' : 'gray'}>+ <Collapsible.Trigger render={<StyledTriggerButton />}>+ <StyledText>{message}</StyledText>+ <IconChevronDown size={theme.icon.size.md} />+ </Collapsible.Trigger>+ </InlineBanner>);};diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/MatchColumns.stories.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/MatchColumns.stories.tsxindex 533ec37808b..b0fb31adf0d 100644--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/MatchColumns.stories.tsx+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/__stories__/MatchColumns.stories.tsx@@ -314,3 +314,34 @@ export const SubMatchingSearchSkipsUnmatchedSelection: Story = {await waitFor(() => expect(trigger).toHaveFocus());},};++export const UnmatchedOptionsBannerKeyboardToggle: Story = {+ beforeEach: SubMatchingSearchSkipsUnmatchedSelection.beforeEach,+ play: async ({ canvasElement }) => {+ const body = within(canvasElement.ownerDocument.body);+ await userEvent.click(+ within(canvasElement).getByRole('button', { name: 'Open import' }),+ );+ const dialog = await body.findByRole('dialog', { name: 'Import data' });+ const bannerTrigger = within(dialog).getByRole('button', {+ name: 'Match Team (0 Unmatched)',+ });+ await expect(bannerTrigger).toHaveAttribute('aria-expanded', 'false');++ bannerTrigger.focus();+ await userEvent.keyboard('{Enter}');+ await expect(bannerTrigger).toHaveAttribute('aria-expanded', 'true');+ await expect(+ await within(dialog).findByRole('button', { name: 'Team Two' }),+ ).toBeVisible();++ await userEvent.keyboard(' ');+ await expect(bannerTrigger).toHaveAttribute('aria-expanded', 'false');+ await waitFor(() =>+ expect(+ within(dialog).queryByRole('button', { name: 'Team Two' }),+ ).not.toBeInTheDocument(),+ );+ await expect(bannerTrigger).toHaveFocus();+ },+};diff --git a/packages/twenty-ui/src/primitives/feedback/Banner/Banner.module.scss b/packages/twenty-ui/src/primitives/feedback/Banner/Banner.module.scssindex f37eabf3d63..3ccd05f61fd 100644--- a/packages/twenty-ui/src/primitives/feedback/Banner/Banner.module.scss+++ b/packages/twenty-ui/src/primitives/feedback/Banner/Banner.module.scss@@ -15,7 +15,7 @@&[data-color='gray'] {--banner-solid-background: var(--t-color-gray);- --banner-soft-background: var(--t-background-transparent-secondary);+ --banner-soft-background: var(--t-background-transparent-light);--banner-soft-color: var(--t-font-color-primary);}diff --git a/packages/twenty-ui/src/primitives/feedback/Banner/__stories__/Banner.stories.tsx b/packages/twenty-ui/src/primitives/feedback/Banner/__stories__/Banner.stories.tsxindex 890746fd5dd..c1b0ecf0fe8 100644--- a/packages/twenty-ui/src/primitives/feedback/Banner/__stories__/Banner.stories.tsx+++ b/packages/twenty-ui/src/primitives/feedback/Banner/__stories__/Banner.stories.tsx@@ -107,6 +107,24 @@ export const CatalogContrast: Story = {},};+export const SoftNeutral: Story = {+ tags: ['!autodocs'],+ args: {+ status: 'neutral',+ variant: 'soft',+ children: 'Contacts are syncing in the background.',+ icon: <IconInfoCircle aria-hidden="true" />,+ action: <Banner.Action>View progress</Banner.Action>,+ },+ parameters: { container: { width: 600 } },+ decorators: [ComponentDecorator],+};++export const SoftNeutralDark: Story = {+ ...SoftNeutral,+ globals: { colorScheme: 'dark' },+};+export const IndependentAppearance: Story = {args: {status: 'error',