From 7067c5cd8c035cb83bde3562f01462d44a768133 Mon Sep 17 00:00:00 2001 From: stanislavh Date: Mon, 29 Apr 2024 12:32:22 +0200 Subject: [PATCH] SONAR-22049 Move ToggleButton to sonar-aligned folder --- .../design-system/src/components/Tabs.tsx | 2 +- .../design-system/src/components/index.ts | 1 - .../design-system/src/helpers/index.ts | 1 - .../components/ToggleButton.tsx | 6 +++--- .../__tests__/ToggleButton-test.tsx | 4 ++-- .../src/sonar-aligned/components/index.ts | 1 + .../helpers/__tests__/tabs-test.ts | 0 .../src/sonar-aligned/helpers/index.ts | 21 +++++++++++++++++++ .../src/{ => sonar-aligned}/helpers/tabs.ts | 0 .../design-system/src/sonar-aligned/index.ts | 1 + 10 files changed, 29 insertions(+), 8 deletions(-) rename server/sonar-web/design-system/src/{ => sonar-aligned}/components/ToggleButton.tsx (95%) rename server/sonar-web/design-system/src/{ => sonar-aligned}/components/__tests__/ToggleButton-test.tsx (95%) rename server/sonar-web/design-system/src/{ => sonar-aligned}/helpers/__tests__/tabs-test.ts (100%) create mode 100644 server/sonar-web/design-system/src/sonar-aligned/helpers/index.ts rename server/sonar-web/design-system/src/{ => sonar-aligned}/helpers/tabs.ts (100%) diff --git a/server/sonar-web/design-system/src/components/Tabs.tsx b/server/sonar-web/design-system/src/components/Tabs.tsx index 21a7fa765c8..aec59acd20a 100644 --- a/server/sonar-web/design-system/src/components/Tabs.tsx +++ b/server/sonar-web/design-system/src/components/Tabs.tsx @@ -21,8 +21,8 @@ import styled from '@emotion/styled'; import { PropsWithChildren } from 'react'; import tw from 'twin.macro'; import { OPACITY_20_PERCENT, themeBorder, themeColor } from '../helpers'; -import { getTabId, getTabPanelId } from '../helpers/tabs'; import { BareButton } from '../sonar-aligned/components/buttons'; +import { getTabId, getTabPanelId } from '../sonar-aligned/helpers/tabs'; import { Badge } from './Badge'; type TabValueType = string | number | boolean; diff --git a/server/sonar-web/design-system/src/components/index.ts b/server/sonar-web/design-system/src/components/index.ts index e94ac812c9e..83d92d655d7 100644 --- a/server/sonar-web/design-system/src/components/index.ts +++ b/server/sonar-web/design-system/src/components/index.ts @@ -75,7 +75,6 @@ export * from './Tags'; export * from './Text'; export * from './TextAccordion'; export * from './Title'; -export * from './ToggleButton'; export { Tooltip } from './Tooltip'; export { TopBar } from './TopBar'; export * from './TreeMap'; diff --git a/server/sonar-web/design-system/src/helpers/index.ts b/server/sonar-web/design-system/src/helpers/index.ts index a648aef78c4..73dd1464b22 100644 --- a/server/sonar-web/design-system/src/helpers/index.ts +++ b/server/sonar-web/design-system/src/helpers/index.ts @@ -21,5 +21,4 @@ export * from './colors'; export * from './constants'; export * from './keyboard'; export * from './positioning'; -export * from './tabs'; export * from './theme'; diff --git a/server/sonar-web/design-system/src/components/ToggleButton.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/ToggleButton.tsx similarity index 95% rename from server/sonar-web/design-system/src/components/ToggleButton.tsx rename to server/sonar-web/design-system/src/sonar-aligned/components/ToggleButton.tsx index 4c6b266b91d..ab0152f38a3 100644 --- a/server/sonar-web/design-system/src/components/ToggleButton.tsx +++ b/server/sonar-web/design-system/src/sonar-aligned/components/ToggleButton.tsx @@ -19,10 +19,10 @@ */ import styled from '@emotion/styled'; import tw from 'twin.macro'; +import { Badge } from '../../components/Badge'; +import { themeBorder, themeColor, themeContrast } from '../../helpers/theme'; import { getTabId, getTabPanelId } from '../helpers/tabs'; -import { themeBorder, themeColor, themeContrast } from '../helpers/theme'; -import { ButtonSecondary } from '../sonar-aligned/components/buttons'; -import { Badge } from './Badge'; +import { ButtonSecondary } from './buttons'; type ToggleButtonValueType = string | number | boolean; diff --git a/server/sonar-web/design-system/src/components/__tests__/ToggleButton-test.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/ToggleButton-test.tsx similarity index 95% rename from server/sonar-web/design-system/src/components/__tests__/ToggleButton-test.tsx rename to server/sonar-web/design-system/src/sonar-aligned/components/__tests__/ToggleButton-test.tsx index f28e9ad443d..7b07cba3ff9 100644 --- a/server/sonar-web/design-system/src/components/__tests__/ToggleButton-test.tsx +++ b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/ToggleButton-test.tsx @@ -19,9 +19,9 @@ */ import { screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; +import { render } from '../../../helpers/testUtils'; +import { FCProps } from '../../../types/misc'; import { getTabPanelId } from '../../helpers'; -import { render } from '../../helpers/testUtils'; -import { FCProps } from '../../types/misc'; import { ToggleButton, ToggleButtonsOption } from '../ToggleButton'; it('should render all options', async () => { diff --git a/server/sonar-web/design-system/src/sonar-aligned/components/index.ts b/server/sonar-web/design-system/src/sonar-aligned/components/index.ts index 9ffeb585803..edbf22d1b66 100644 --- a/server/sonar-web/design-system/src/sonar-aligned/components/index.ts +++ b/server/sonar-web/design-system/src/sonar-aligned/components/index.ts @@ -22,5 +22,6 @@ export * from './Card'; export { DismissableFlagMessage, FlagMessage } from './FlagMessage'; export * from './MetricsRatingBadge'; export * from './Table'; +export * from './ToggleButton'; export * from './buttons'; export * from './typography'; diff --git a/server/sonar-web/design-system/src/helpers/__tests__/tabs-test.ts b/server/sonar-web/design-system/src/sonar-aligned/helpers/__tests__/tabs-test.ts similarity index 100% rename from server/sonar-web/design-system/src/helpers/__tests__/tabs-test.ts rename to server/sonar-web/design-system/src/sonar-aligned/helpers/__tests__/tabs-test.ts diff --git a/server/sonar-web/design-system/src/sonar-aligned/helpers/index.ts b/server/sonar-web/design-system/src/sonar-aligned/helpers/index.ts new file mode 100644 index 00000000000..863797b2d1f --- /dev/null +++ b/server/sonar-web/design-system/src/sonar-aligned/helpers/index.ts @@ -0,0 +1,21 @@ +/* + * SonarQube + * Copyright (C) 2009-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +export * from './tabs'; diff --git a/server/sonar-web/design-system/src/helpers/tabs.ts b/server/sonar-web/design-system/src/sonar-aligned/helpers/tabs.ts similarity index 100% rename from server/sonar-web/design-system/src/helpers/tabs.ts rename to server/sonar-web/design-system/src/sonar-aligned/helpers/tabs.ts diff --git a/server/sonar-web/design-system/src/sonar-aligned/index.ts b/server/sonar-web/design-system/src/sonar-aligned/index.ts index 48fc39c2122..380e82087fb 100644 --- a/server/sonar-web/design-system/src/sonar-aligned/index.ts +++ b/server/sonar-web/design-system/src/sonar-aligned/index.ts @@ -19,4 +19,5 @@ */ export * from './components'; +export * from './helpers'; export * from './types'; -- 2.39.5