diff options
Diffstat (limited to 'server/sonar-web/design-system')
12 files changed, 107 insertions, 23 deletions
diff --git a/server/sonar-web/design-system/src/components/index.ts b/server/sonar-web/design-system/src/components/index.ts index b5b2e73515a..ae2932330ec 100644 --- a/server/sonar-web/design-system/src/components/index.ts +++ b/server/sonar-web/design-system/src/components/index.ts @@ -25,7 +25,6 @@ export { BarChart } from './BarChart'; export * from './BorderlessAccordion'; export { Breadcrumbs } from './Breadcrumbs'; export * from './BubbleChart'; -export * from './Card'; export * from './CodeSnippet'; export * from './CodeSyntaxHighlighter'; export * from './ColorsLegend'; @@ -57,7 +56,6 @@ export * from './LocationMarker'; export * from './MainAppBar'; export * from './MainMenu'; export * from './MainMenuItem'; -export * from './MetricsRatingBadge'; export * from './MultiSelector'; export * from './NavBarTabs'; export * from './NewCodeLegend'; diff --git a/server/sonar-web/design-system/src/index.ts b/server/sonar-web/design-system/src/index.ts index 992d51242bf..3bac299b5e3 100644 --- a/server/sonar-web/design-system/src/index.ts +++ b/server/sonar-web/design-system/src/index.ts @@ -19,5 +19,6 @@ */ export * from './components'; export * from './helpers'; +export * from './sonar-aligned'; export * from './theme'; export * from './types'; diff --git a/server/sonar-web/design-system/src/components/Card.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/Card.tsx index ef9c63f3c92..a8f7c8ce929 100644 --- a/server/sonar-web/design-system/src/components/Card.tsx +++ b/server/sonar-web/design-system/src/sonar-aligned/components/Card.tsx @@ -20,8 +20,8 @@ import styled from '@emotion/styled'; import * as React from 'react'; import tw from 'twin.macro'; -import { themeBorder, themeColor } from '../helpers/theme'; -import { BasicSeparator } from './Separator'; +import { BasicSeparator } from '../../components/Separator'; +import { themeBorder, themeColor } from '../../helpers/theme'; interface CardProps extends React.HTMLAttributes<HTMLDivElement> { children: React.ReactNode; diff --git a/server/sonar-web/design-system/src/components/MetricsRatingBadge.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/MetricsRatingBadge.tsx index d82e9a86843..9bdae72f604 100644 --- a/server/sonar-web/design-system/src/components/MetricsRatingBadge.tsx +++ b/server/sonar-web/design-system/src/sonar-aligned/components/MetricsRatingBadge.tsx @@ -19,14 +19,14 @@ */ import styled from '@emotion/styled'; import tw from 'twin.macro'; -import { getProp, themeColor, themeContrast } from '../helpers/theme'; -import { MetricsLabel } from '../types/measures'; +import { getProp, themeColor, themeContrast } from '../../helpers/theme'; +import { RatingLabel } from '../types/measures'; type sizeType = keyof typeof SIZE_MAPPING; interface Props extends React.AriaAttributes { className?: string; - label: string; - rating?: MetricsLabel; + label?: string; + rating?: RatingLabel; size?: sizeType; } @@ -90,7 +90,7 @@ const getFontSize = (size: string) => { } }; -const MetricsRatingBadgeStyled = styled.div<{ rating: MetricsLabel; size: string }>` +const MetricsRatingBadgeStyled = styled.div<{ rating: RatingLabel; size: string }>` width: ${getProp('size')}; height: ${getProp('size')}; color: ${({ rating }) => themeContrast(`rating.${rating}`)}; diff --git a/server/sonar-web/design-system/src/components/__tests__/Card-test.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/Card-test.tsx index f6d02f77f8d..817af9d4da6 100644 --- a/server/sonar-web/design-system/src/components/__tests__/Card-test.tsx +++ b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/Card-test.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { screen } from '@testing-library/react'; -import { render } from '../../helpers/testUtils'; +import { render } from '../../../helpers/testUtils'; import { Card, GreyCard, LightGreyCard } from '../Card'; it('renders card correctly', () => { diff --git a/server/sonar-web/design-system/src/components/__tests__/MetricsRatingBadge-test.tsx b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/MetricsRatingBadge-test.tsx index 31e15fedbed..8342ab1ca6c 100644 --- a/server/sonar-web/design-system/src/components/__tests__/MetricsRatingBadge-test.tsx +++ b/server/sonar-web/design-system/src/sonar-aligned/components/__tests__/MetricsRatingBadge-test.tsx @@ -18,8 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { screen } from '@testing-library/react'; -import { render } from '../../helpers/testUtils'; -import { FCProps } from '../../types/misc'; +import { render } from '../../../helpers/testUtils'; +import { FCProps } from '../../../types/misc'; import { MetricsRatingBadge } from '../MetricsRatingBadge'; 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 new file mode 100644 index 00000000000..4aff4e3e703 --- /dev/null +++ b/server/sonar-web/design-system/src/sonar-aligned/components/index.ts @@ -0,0 +1,22 @@ +/* + * 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 './Card'; +export * from './MetricsRatingBadge'; diff --git a/server/sonar-web/design-system/src/sonar-aligned/index.ts b/server/sonar-web/design-system/src/sonar-aligned/index.ts new file mode 100644 index 00000000000..48fc39c2122 --- /dev/null +++ b/server/sonar-web/design-system/src/sonar-aligned/index.ts @@ -0,0 +1,22 @@ +/* + * 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 './components'; +export * from './types'; diff --git a/server/sonar-web/design-system/src/sonar-aligned/types/index.ts b/server/sonar-web/design-system/src/sonar-aligned/types/index.ts new file mode 100644 index 00000000000..076ba52f860 --- /dev/null +++ b/server/sonar-web/design-system/src/sonar-aligned/types/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 './measures'; diff --git a/server/sonar-web/design-system/src/sonar-aligned/types/measures.ts b/server/sonar-web/design-system/src/sonar-aligned/types/measures.ts new file mode 100644 index 00000000000..b7e402a65f7 --- /dev/null +++ b/server/sonar-web/design-system/src/sonar-aligned/types/measures.ts @@ -0,0 +1,29 @@ +/* + * 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 enum RatingEnum { + A = 'A', + B = 'B', + C = 'C', + D = 'D', + E = 'E', +} + +export type RatingLabel = keyof typeof RatingEnum; diff --git a/server/sonar-web/design-system/src/types/measures.ts b/server/sonar-web/design-system/src/types/measures.ts index a118f888231..71ee1b988de 100644 --- a/server/sonar-web/design-system/src/types/measures.ts +++ b/server/sonar-web/design-system/src/types/measures.ts @@ -28,16 +28,6 @@ export enum DuplicationEnum { export type DuplicationLabel = keyof typeof DuplicationEnum; -export enum MetricsEnum { - A = 'A', - B = 'B', - C = 'C', - D = 'D', - E = 'E', -} - -export type MetricsLabel = keyof typeof MetricsEnum; - export enum SizeEnum { XS = 'XS', S = 'S', diff --git a/server/sonar-web/design-system/tsconfig.json b/server/sonar-web/design-system/tsconfig.json index 9563ae0ec9f..22b2e4e8bec 100644 --- a/server/sonar-web/design-system/tsconfig.json +++ b/server/sonar-web/design-system/tsconfig.json @@ -16,7 +16,8 @@ "~helpers/*": ["src/helpers/*"], "~icons/*": ["src/icons/*"], "~types/*": ["src/types/*"], - "~utils/*": ["src/utils/*"] + "~utils/*": ["src/utils/*"], + "~sonar-aligned/*": ["src/sonar-aligned/*"] }, "resolveJsonModule": true, "skipLibCheck": true |