From 4c11c2c2b1a22f30f3c3902e1c0a8ead39bd6cc5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Wed, 6 Mar 2024 16:42:31 -0600 Subject: [PATCH] SONAR-21656 Replace old icons with MIUI icons --- .../src/components/icons/CollapseIcon.tsx | 36 +++++ .../src/components/icons/ExpandIcon.tsx | 36 +++++ .../src/components/icons/MinimizeIcon.tsx} | 14 +- .../src/components/icons/QualifierIcon.tsx | 8 +- .../src/components/icons/index.ts | 3 + .../design-system/src/theme/light.ts | 6 + .../use-componentqualifier-enum.js | 5 +- .../global-search/GlobalSearchResult.tsx | 5 +- .../branch-like/CurrentBranchLike.tsx | 2 +- .../nav/component/branch-like/MenuItem.tsx | 2 +- .../components/CustomRuleFormFieldsCCT.tsx | 2 +- .../coding-rules/components/SeverityFacet.tsx | 2 +- .../components/SeveritySelect.tsx | 4 +- .../coding-rules/components/TypeFacet.tsx | 4 +- .../js/apps/issues/sidebar/SeverityFacet.tsx | 2 +- .../branches/QualityGateCondition.tsx | 4 +- .../overview/branches/SonarLintPromotion.tsx | 4 +- .../components/BranchLikeRow.tsx | 2 +- .../components/BranchListRow.tsx | 2 +- .../components/HotspotSimpleList.tsx | 9 +- .../components/HotspotSnippetHeader.tsx | 14 +- .../AuthenticationFormField.tsx | 35 +++-- .../AlmSpecificForm.tsx | 5 +- .../PRDecorationBindingRenderer.tsx | 4 +- .../ChartLegend.tsx} | 2 +- .../activity-graph/GraphsLegendItem.tsx | 4 +- .../activity-graph/GraphsTooltipsContent.tsx | 4 +- .../src/main/js/components/common/Link.tsx | 10 +- .../main/js/components/common/MetaLink.tsx | 36 ++--- .../components/controls/ValidationInput.tsx | 108 ------------- .../BranchLikeIcon.tsx | 5 +- .../IssueStatusIcon.tsx | 2 +- .../components/icon-mappers/IssueTypeIcon.tsx | 24 --- .../SeverityIcon.tsx} | 41 +++-- .../SoftwareImpactSeverityIcon.tsx | 2 +- .../__tests__/BranchLikeIcon-test.tsx | 2 +- .../BranchLikeIcon-test.tsx.snap | 0 .../js/components/icons/AlertErrorIcon.tsx | 33 ---- .../js/components/icons/AlertSuccessIcon.tsx | 33 ---- .../js/components/icons/AlertWarnIcon.tsx | 33 ---- .../src/main/js/components/icons/BackIcon.tsx | 32 ---- .../src/main/js/components/icons/BugIcon.tsx | 36 ----- .../js/components/icons/BugTrackerIcon.tsx | 32 ---- .../js/components/icons/BulletListIcon.tsx | 32 ---- .../main/js/components/icons/CalendarIcon.tsx | 32 ---- .../js/components/icons/ChevronDownIcon.tsx | 32 ---- .../js/components/icons/ChevronRightIcon.tsx | 32 ---- .../main/js/components/icons/ClearIcon.tsx | 43 ------ .../js/components/icons/CodeSmellIcon.tsx | 32 ---- .../main/js/components/icons/CollapseIcon.tsx | 32 ---- .../icons/ContinuousIntegrationIcon.tsx | 35 ----- .../main/js/components/icons/DeleteIcon.tsx | 32 ---- .../main/js/components/icons/DetachIcon.tsx | 32 ---- .../main/js/components/icons/DropdownIcon.tsx | 47 ------ .../src/main/js/components/icons/EditIcon.tsx | 32 ---- .../main/js/components/icons/EllipsisIcon.tsx | 32 ---- .../main/js/components/icons/ExpandIcon.tsx | 32 ---- .../main/js/components/icons/FavoriteIcon.tsx | 41 ----- .../main/js/components/icons/GroupIcon.tsx | 35 ----- .../main/js/components/icons/HistoryIcon.tsx | 32 ---- .../main/js/components/icons/HouseIcon.tsx | 32 ---- .../src/main/js/components/icons/Icon.tsx | 83 ---------- .../src/main/js/components/icons/InfoIcon.tsx | 32 ---- .../main/js/components/icons/IssueIcon.tsx | 45 ------ .../js/components/icons/IssueTypeIcon.tsx | 58 ------- .../src/main/js/components/icons/LinkIcon.tsx | 34 ---- .../src/main/js/components/icons/LockIcon.tsx | 32 ---- .../main/js/components/icons/MinimizeIcon.tsx | 32 ---- .../js/components/icons/OpenCloseIcon.tsx | 31 ---- .../main/js/components/icons/PendingIcon.tsx | 35 ----- .../js/components/icons/PlusCircleIcon.tsx | 32 ---- .../js/components/icons/ProjectLinkIcon.tsx | 53 ------- .../js/components/icons/PullRequestIcon.tsx | 33 ---- .../js/components/icons/QualifierIcon.tsx | 146 ------------------ .../js/components/icons/RecommendedIcon.tsx | 32 ---- .../src/main/js/components/icons/SCMIcon.tsx | 32 ---- .../main/js/components/icons/SearchIcon.tsx | 32 ---- .../components/icons/SecurityHotspotIcon.tsx | 32 ---- .../main/js/components/icons/SettingsIcon.tsx | 38 ----- .../main/js/components/icons/SeverityIcon.tsx | 102 ------------ .../src/main/js/components/icons/TagsIcon.tsx | 32 ---- .../js/components/icons/VulnerabilityIcon.tsx | 32 ---- .../main/js/components/icons/WarningIcon.tsx | 33 ---- .../components/icons/__tests__/Icon-test.tsx | 35 ----- .../__snapshots__/Icon-test.tsx.snap | 3 - .../issue/components/SonarLintBadge.tsx | 30 ++-- .../SonarLintLogo.tsx} | 32 +++- .../js/components/permissions/GroupHolder.tsx | 5 +- .../js/components/shared/SeverityHelper.tsx | 10 +- .../components/shared/SoftwareImpactPill.tsx | 2 +- .../js/components/shared/StatusHelper.tsx | 2 +- .../workspace/WorkspaceComponentTitle.tsx | 13 +- .../components/workspace/WorkspaceHeader.tsx | 63 ++++++-- .../js/components/workspace/WorkspaceNav.tsx | 17 +- .../components/workspace/WorkspaceNavItem.tsx | 39 +++-- .../workspace/__tests__/Workspace-test.tsx | 8 +- .../main/js/components/workspace/styles.css | 76 --------- 97 files changed, 364 insertions(+), 2248 deletions(-) create mode 100644 server/sonar-web/design-system/src/components/icons/CollapseIcon.tsx create mode 100644 server/sonar-web/design-system/src/components/icons/ExpandIcon.tsx rename server/sonar-web/{src/main/js/components/icons/MeasuresIcon.tsx => design-system/src/components/icons/MinimizeIcon.tsx} (68%) rename server/sonar-web/src/main/js/components/{icons/ChartLegendIcon.tsx => activity-graph/ChartLegend.tsx} (96%) delete mode 100644 server/sonar-web/src/main/js/components/controls/ValidationInput.tsx rename server/sonar-web/src/main/js/components/{icons => icon-mappers}/BranchLikeIcon.tsx (89%) rename server/sonar-web/src/main/js/components/{icons => icon-mappers}/IssueStatusIcon.tsx (98%) rename server/sonar-web/src/main/js/components/{ui/MandatoryFieldMarker.tsx => icon-mappers/SeverityIcon.tsx} (51%) rename server/sonar-web/src/main/js/components/{icons => icon-mappers}/SoftwareImpactSeverityIcon.tsx (98%) rename server/sonar-web/src/main/js/components/{icons => icon-mappers}/__tests__/BranchLikeIcon-test.tsx (94%) rename server/sonar-web/src/main/js/components/{icons => icon-mappers}/__tests__/__snapshots__/BranchLikeIcon-test.tsx.snap (100%) delete mode 100644 server/sonar-web/src/main/js/components/icons/AlertErrorIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/AlertSuccessIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/AlertWarnIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/BackIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/BugIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/BugTrackerIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/BulletListIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/CalendarIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/ChevronDownIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/ChevronRightIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/ClearIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/CodeSmellIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/CollapseIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/ContinuousIntegrationIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/DeleteIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/DetachIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/DropdownIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/EditIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/EllipsisIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/ExpandIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/FavoriteIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/GroupIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/HistoryIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/HouseIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/Icon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/InfoIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/IssueIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/IssueTypeIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/LinkIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/LockIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/MinimizeIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/OpenCloseIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/PendingIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/PlusCircleIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/ProjectLinkIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/PullRequestIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/RecommendedIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/SCMIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/SearchIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/SecurityHotspotIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/SettingsIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/TagsIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/VulnerabilityIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/WarningIcon.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/__tests__/Icon-test.tsx delete mode 100644 server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/Icon-test.tsx.snap rename server/sonar-web/src/main/js/components/{icons/SonarLintIcon.tsx => logos/SonarLintLogo.tsx} (73%) diff --git a/server/sonar-web/design-system/src/components/icons/CollapseIcon.tsx b/server/sonar-web/design-system/src/components/icons/CollapseIcon.tsx new file mode 100644 index 00000000000..27e37e1a5d5 --- /dev/null +++ b/server/sonar-web/design-system/src/components/icons/CollapseIcon.tsx @@ -0,0 +1,36 @@ +/* + * 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. + */ +import { useTheme } from '@emotion/react'; +import { themeColor } from '../../helpers/theme'; +import { CustomIcon, IconProps } from './Icon'; + +export function CollapseIcon({ fill = 'currentColor', ...iconProps }: Readonly) { + const theme = useTheme(); + return ( + + + + ); +} diff --git a/server/sonar-web/design-system/src/components/icons/ExpandIcon.tsx b/server/sonar-web/design-system/src/components/icons/ExpandIcon.tsx new file mode 100644 index 00000000000..84cff94c5e3 --- /dev/null +++ b/server/sonar-web/design-system/src/components/icons/ExpandIcon.tsx @@ -0,0 +1,36 @@ +/* + * 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. + */ +import { useTheme } from '@emotion/react'; +import { themeColor } from '../../helpers/theme'; +import { CustomIcon, IconProps } from './Icon'; + +export function ExpandIcon({ fill = 'currentColor', ...iconProps }: Readonly) { + const theme = useTheme(); + return ( + + + + ); +} diff --git a/server/sonar-web/src/main/js/components/icons/MeasuresIcon.tsx b/server/sonar-web/design-system/src/components/icons/MinimizeIcon.tsx similarity index 68% rename from server/sonar-web/src/main/js/components/icons/MeasuresIcon.tsx rename to server/sonar-web/design-system/src/components/icons/MinimizeIcon.tsx index 8803ae0febc..636c759485c 100644 --- a/server/sonar-web/src/main/js/components/icons/MeasuresIcon.tsx +++ b/server/sonar-web/design-system/src/components/icons/MinimizeIcon.tsx @@ -17,13 +17,15 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; +import { useTheme } from '@emotion/react'; +import { themeColor } from '../../helpers/theme'; +import { CustomIcon, IconProps } from './Icon'; -export default function MeasuresIcon({ fill = 'currentColor', ...iconProps }: IconProps) { +export function MinimizeIcon({ fill = 'currentColor', ...iconProps }: Readonly) { + const theme = useTheme(); return ( - - - + + + ); } diff --git a/server/sonar-web/design-system/src/components/icons/QualifierIcon.tsx b/server/sonar-web/design-system/src/components/icons/QualifierIcon.tsx index fd3e9fee74b..34c09a7906e 100644 --- a/server/sonar-web/design-system/src/components/icons/QualifierIcon.tsx +++ b/server/sonar-web/design-system/src/components/icons/QualifierIcon.tsx @@ -29,7 +29,7 @@ interface Props extends IconProps { qualifier: string | null | undefined; } -export function QualifierIcon({ qualifier, fill, ...iconProps }: Props) { +export function QualifierIcon({ qualifier, fill, ...iconProps }: Readonly) { const theme = useTheme(); if (!qualifier) { @@ -49,7 +49,7 @@ export function QualifierIcon({ qualifier, fill, ...iconProps }: Props) { return icon ?? null; } -function PortfolioIcon({ fill = 'currentColor', ...iconProps }: IconProps) { +function PortfolioIcon({ fill = 'currentColor', ...iconProps }: Readonly) { const theme = useTheme(); return ( @@ -62,7 +62,7 @@ function PortfolioIcon({ fill = 'currentColor', ...iconProps }: IconProps) { ); } -function ApplicationIcon({ fill = 'currentColor', ...iconProps }: IconProps) { +function ApplicationIcon({ fill = 'currentColor', ...iconProps }: Readonly) { const theme = useTheme(); return ( @@ -75,7 +75,7 @@ function ApplicationIcon({ fill = 'currentColor', ...iconProps }: IconProps) { ); } -function SubPortfolioIcon({ fill = 'currentColor', ...iconProps }: IconProps) { +function SubPortfolioIcon({ fill = 'currentColor', ...iconProps }: Readonly) { const theme = useTheme(); return ( diff --git a/server/sonar-web/design-system/src/components/icons/index.ts b/server/sonar-web/design-system/src/components/icons/index.ts index 1a5e151422a..fec55fb5a09 100644 --- a/server/sonar-web/design-system/src/components/icons/index.ts +++ b/server/sonar-web/design-system/src/components/icons/index.ts @@ -27,11 +27,13 @@ export { ChevronRightIcon } from './ChevronRightIcon'; export { ClockIcon } from './ClockIcon'; export { CloseIcon } from './CloseIcon'; export { CodeSmellIcon } from './CodeSmellIcon'; +export { CollapseIcon } from './CollapseIcon'; export { CommentIcon } from './CommentIcon'; export { CopyIcon } from './CopyIcon'; export { DirectoryIcon } from './DirectoryIcon'; export { DraggableIcon } from './DraggableIcon'; export { ExecutionFlowIcon } from './ExecutionFlowIcon'; +export { ExpandIcon } from './ExpandIcon'; export { FileIcon } from './FileIcon'; export { FilterIcon } from './FilterIcon'; export { FlagErrorIcon } from './FlagErrorIcon'; @@ -51,6 +53,7 @@ export { MainBranchIcon } from './MainBranchIcon'; export { MenuHelpIcon } from './MenuHelpIcon'; export { MenuIcon } from './MenuIcon'; export { MenuSearchIcon } from './MenuSearchIcon'; +export { MinimizeIcon } from './MinimizeIcon'; export { NoDataIcon } from './NoDataIcon'; export { OpenCloseIndicator } from './OpenCloseIndicator'; export { OpenNewTabIcon } from './OpenNewTabIcon'; diff --git a/server/sonar-web/design-system/src/theme/light.ts b/server/sonar-web/design-system/src/theme/light.ts index fb5d41f4766..f5f33fcac32 100644 --- a/server/sonar-web/design-system/src/theme/light.ts +++ b/server/sonar-web/design-system/src/theme/light.ts @@ -661,6 +661,12 @@ export const lightTheme = { promotionNotification: COLORS.blueGrey[35], promotionNotificationBackground: COLORS.blueGrey[700], promotionNotificationSeparator: COLORS.blueGrey[500], + + // Workspace + workSpaceViewerBackground: COLORS.blueGrey[25], + workSpaceViewerShadow: COLORS.blueGrey[700], + workSpaceNavItem: COLORS.white, + workSpaceNavItemBackground: COLORS.blueGrey[500], }, // contrast colors to be used for text when using a color background with the same name diff --git a/server/sonar-web/eslint-local-rules/use-componentqualifier-enum.js b/server/sonar-web/eslint-local-rules/use-componentqualifier-enum.js index 88a10cb3c53..3ccabbf5897 100644 --- a/server/sonar-web/eslint-local-rules/use-componentqualifier-enum.js +++ b/server/sonar-web/eslint-local-rules/use-componentqualifier-enum.js @@ -18,7 +18,4 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ const { useEnum } = require('./lib/use-enum'); -module.exports = useEnum( - ['APP', 'DIR', 'DEV', 'FIL', 'VW', 'TRK', 'SVW', 'UTS'], - 'ComponentQualifier' -); +module.exports = useEnum(['APP', 'DIR', 'FIL', 'VW', 'TRK', 'SVW', 'UTS'], 'ComponentQualifier'); diff --git a/server/sonar-web/src/main/js/app/components/global-search/GlobalSearchResult.tsx b/server/sonar-web/src/main/js/app/components/global-search/GlobalSearchResult.tsx index 6d9b3b4b86f..55de63a2874 100644 --- a/server/sonar-web/src/main/js/app/components/global-search/GlobalSearchResult.tsx +++ b/server/sonar-web/src/main/js/app/components/global-search/GlobalSearchResult.tsx @@ -18,9 +18,8 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import classNames from 'classnames'; -import { ClockIcon, ItemLink, TextBold, TextMuted } from 'design-system'; +import { ClockIcon, ItemLink, StarFillIcon, TextBold, TextMuted } from 'design-system'; import * as React from 'react'; -import FavoriteIcon from '../../../components/icons/FavoriteIcon'; import { translate } from '../../../helpers/l10n'; import { getComponentOverviewUrl } from '../../../helpers/urls'; import { ComponentResult } from './utils'; @@ -56,7 +55,7 @@ export default class GlobalSearchResult extends React.PureComponent {
- {component.isFavorite && } + {component.isFavorite && } {!component.isFavorite && component.isRecentlyBrowsed && ( )} diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx index 6805c31b2fc..61b7ef285a1 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/CurrentBranchLike.tsx @@ -19,7 +19,7 @@ */ import { ChevronDownIcon, TextMuted } from 'design-system'; import * as React from 'react'; -import BranchLikeIcon from '../../../../../components/icons/BranchLikeIcon'; +import BranchLikeIcon from '../../../../../components/icon-mappers/BranchLikeIcon'; import { getBranchLikeDisplayName } from '../../../../../helpers/branch-like'; import { BranchLike, BranchStatusData } from '../../../../../types/branch-like'; import QualityGateStatus from './QualityGateStatus'; diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItem.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItem.tsx index 39034306b96..3263a64929b 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItem.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/MenuItem.tsx @@ -20,7 +20,7 @@ import classNames from 'classnames'; import { Badge, ItemButton, TextBold, TextMuted } from 'design-system'; import * as React from 'react'; -import BranchLikeIcon from '../../../../../components/icons/BranchLikeIcon'; +import BranchLikeIcon from '../../../../../components/icon-mappers/BranchLikeIcon'; import { getBranchLikeDisplayName, isMainBranch } from '../../../../../helpers/branch-like'; import { translate } from '../../../../../helpers/l10n'; import { BranchLike } from '../../../../../types/branch-like'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormFieldsCCT.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormFieldsCCT.tsx index b5b8743cad2..70362092ddd 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormFieldsCCT.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormFieldsCCT.tsx @@ -28,7 +28,7 @@ import { } from 'design-system'; import React from 'react'; import { useIntl } from 'react-intl'; -import SoftwareImpactSeverityIcon from '../../../components/icons/SoftwareImpactSeverityIcon'; +import SoftwareImpactSeverityIcon from '../../../components/icon-mappers/SoftwareImpactSeverityIcon'; import { CLEAN_CODE_ATTRIBUTES_BY_CATEGORY, CLEAN_CODE_CATEGORIES, diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/SeverityFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/SeverityFacet.tsx index 39caf9fa265..da7cd21b1c1 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/SeverityFacet.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/SeverityFacet.tsx @@ -20,7 +20,7 @@ import { HelperHintIcon } from 'design-system'; import * as React from 'react'; import DocumentationTooltip from '../../../components/common/DocumentationTooltip'; -import SoftwareImpactSeverityIcon from '../../../components/icons/SoftwareImpactSeverityIcon'; +import SoftwareImpactSeverityIcon from '../../../components/icon-mappers/SoftwareImpactSeverityIcon'; import { IMPACT_SEVERITIES } from '../../../helpers/constants'; import { translate } from '../../../helpers/l10n'; import Facet, { BasicProps } from './Facet'; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx index fa015724dfa..5b39ade4564 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/SeveritySelect.tsx @@ -34,7 +34,7 @@ export interface SeveritySelectProps { function Option(props: Readonly, false>>) { return ( - + ); } @@ -44,7 +44,7 @@ function SingleValue( ) { return ( - + ); } diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx index fadac0aea79..c92a3c11697 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/TypeFacet.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import IssueTypeIcon from '../../../components/icons/IssueTypeIcon'; +import IssueTypeIcon from '../../../components/icon-mappers/IssueTypeIcon'; import { RULE_TYPES } from '../../../helpers/constants'; import { translate } from '../../../helpers/l10n'; import Facet, { BasicProps } from './Facet'; @@ -26,7 +26,7 @@ import Facet, { BasicProps } from './Facet'; export default class TypeFacet extends React.PureComponent { renderName = (type: string) => ( <> - + {translate('issue.type', type)} ); diff --git a/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx b/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx index 5ee99e70149..ca5ddc08eba 100644 --- a/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx +++ b/server/sonar-web/src/main/js/apps/issues/sidebar/SeverityFacet.tsx @@ -20,7 +20,7 @@ import { HelperHintIcon } from 'design-system'; import * as React from 'react'; import DocumentationTooltip from '../../../components/common/DocumentationTooltip'; -import SoftwareImpactSeverityIcon from '../../../components/icons/SoftwareImpactSeverityIcon'; +import SoftwareImpactSeverityIcon from '../../../components/icon-mappers/SoftwareImpactSeverityIcon'; import { IMPACT_SEVERITIES } from '../../../helpers/constants'; import { translate } from '../../../helpers/l10n'; import { SoftwareImpactSeverity } from '../../../types/clean-code-taxonomy'; diff --git a/server/sonar-web/src/main/js/apps/overview/branches/QualityGateCondition.tsx b/server/sonar-web/src/main/js/apps/overview/branches/QualityGateCondition.tsx index dda75f63084..a3dd605d790 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/QualityGateCondition.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/QualityGateCondition.tsx @@ -20,7 +20,7 @@ import { LinkBox, TextMuted } from 'design-system'; import * as React from 'react'; import { Path } from 'react-router-dom'; -import IssueTypeIcon from '../../../components/icons/IssueTypeIcon'; +import IssueTypeIcon from '../../../components/icon-mappers/IssueTypeIcon'; import MeasureIndicator from '../../../components/measure/MeasureIndicator'; import { DEFAULT_ISSUES_QUERY, @@ -169,7 +169,7 @@ export default class QualityGateCondition extends React.PureComponent { />
- + {this.getPrimaryText()} diff --git a/server/sonar-web/src/main/js/apps/overview/branches/SonarLintPromotion.tsx b/server/sonar-web/src/main/js/apps/overview/branches/SonarLintPromotion.tsx index dbcf3ecb876..359543f422c 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/SonarLintPromotion.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/SonarLintPromotion.tsx @@ -21,7 +21,7 @@ import { Card, DiscreetLink } from 'design-system'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext'; -import SonarLintIcon from '../../../components/icons/SonarLintIcon'; +import { SonarLintLogo } from '../../../components/logos/SonarLintLogo'; import { translate } from '../../../helpers/l10n'; import { MetricKey } from '../../../types/metrics'; import { QualityGateStatusCondition } from '../../../types/quality-gates'; @@ -73,7 +73,7 @@ export function SonarLintPromotion({ currentUser, qgConditions }: SonarLintPromo SonarLint - + ), diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx index 583032968eb..a4c5369ae30 100644 --- a/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx +++ b/server/sonar-web/src/main/js/apps/projectBranches/components/BranchLikeRow.tsx @@ -28,7 +28,7 @@ import { } from 'design-system'; import * as React from 'react'; import QualityGateStatus from '../../../app/components/nav/component/branch-like/QualityGateStatus'; -import BranchLikeIcon from '../../../components/icons/BranchLikeIcon'; +import BranchLikeIcon from '../../../components/icon-mappers/BranchLikeIcon'; import DateFromNow from '../../../components/intl/DateFromNow'; import { getBranchLikeDisplayName, diff --git a/server/sonar-web/src/main/js/apps/projectNewCode/components/BranchListRow.tsx b/server/sonar-web/src/main/js/apps/projectNewCode/components/BranchListRow.tsx index 30546ed08e3..8d0b663ed8b 100644 --- a/server/sonar-web/src/main/js/apps/projectNewCode/components/BranchListRow.tsx +++ b/server/sonar-web/src/main/js/apps/projectNewCode/components/BranchListRow.tsx @@ -30,7 +30,7 @@ import { } from 'design-system'; import * as React from 'react'; import Tooltip from '../../../components/controls/Tooltip'; -import BranchLikeIcon from '../../../components/icons/BranchLikeIcon'; +import BranchLikeIcon from '../../../components/icon-mappers/BranchLikeIcon'; import DateTimeFormatter from '../../../components/intl/DateTimeFormatter'; import { translate, translateWithParameters } from '../../../helpers/l10n'; import { isNewCodeDefinitionCompliant } from '../../../helpers/new-code-definition'; diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSimpleList.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSimpleList.tsx index cb53d46f521..6772aa542e6 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSimpleList.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSimpleList.tsx @@ -19,12 +19,12 @@ */ import { withTheme } from '@emotion/react'; import styled from '@emotion/styled'; -import { Badge, SubnavigationAccordion, themeColor } from 'design-system'; +import { Badge, QualifierIcon, SubnavigationAccordion, themeColor } from 'design-system'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import ListFooter from '../../../components/controls/ListFooter'; import Tooltip from '../../../components/controls/Tooltip'; -import QualifierIcon from '../../../components/icons/QualifierIcon'; + import { translate } from '../../../helpers/l10n'; import { fileFromPath } from '../../../helpers/path'; import { ComponentQualifier } from '../../../types/component'; @@ -91,10 +91,7 @@ export default function HotspotSimpleList(props: HotspotSimpleListProps) { {filterByFile ? ( - + {fileFromPath(filterByFile)} diff --git a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetHeader.tsx b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetHeader.tsx index 8a724c25ef3..11e179a5dda 100644 --- a/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetHeader.tsx +++ b/server/sonar-web/src/main/js/apps/security-hotspots/components/HotspotSnippetHeader.tsx @@ -19,10 +19,11 @@ */ import { withTheme } from '@emotion/react'; import styled from '@emotion/styled'; -import { ClipboardIconButton, HoverLink, Note, themeBorder, themeColor } from 'design-system'; +import { ClipboardIconButton, Note, QualifierIcon, themeBorder, themeColor } from 'design-system'; import React from 'react'; import withCurrentUserContext from '../../../app/components/current-user/withCurrentUserContext'; -import QualifierIcon from '../../../components/icons/QualifierIcon'; + +import { LinkHighlight, LinkStandalone } from '@sonarsource/echoes-react'; import { translate } from '../../../helpers/l10n'; import { collapsedDirFromPath, fileFromPath } from '../../../helpers/path'; import { getBranchLikeUrl } from '../../../helpers/urls'; @@ -57,10 +58,13 @@ function HotspotSnippetHeader(props: HotspotSnippetHeaderProps) { {displayProjectName && ( - - + } + to={getBranchLikeUrl(project.key, branchLike)} + > {project.name} - + )} diff --git a/server/sonar-web/src/main/js/apps/settings/components/authentication/AuthenticationFormField.tsx b/server/sonar-web/src/main/js/apps/settings/components/authentication/AuthenticationFormField.tsx index 44c23adcbb7..17b4380adb5 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/authentication/AuthenticationFormField.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/authentication/AuthenticationFormField.tsx @@ -18,12 +18,18 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import styled from '@emotion/styled'; -import { FormField, Highlight, InputField, Note, RequiredIcon } from 'design-system'; +import { + FlagErrorIcon, + FormField, + Highlight, + InputField, + Note, + RequiredIcon, + TextError, +} from 'design-system'; import React from 'react'; import { useIntl } from 'react-intl'; -import ValidationInput, { - ValidationInputErrorPlacement, -} from '../../../../components/controls/ValidationInput'; +import { isDefined } from '../../../../helpers/types'; import { DefinitionV2, ExtendedSettingDefinition, SettingType } from '../../../../types/settings'; import { getPropertyDescription, getPropertyName, isSecuredDefinition } from '../../utils'; import AuthenticationMultiValueField from './AuthenticationMultiValuesField'; @@ -101,22 +107,29 @@ export default function AuthenticationFormField(props: Readonly) { {!isSecuredDefinition(definition) && definition.type === undefined && !definition.multiValues && ( - + <> props.onFieldChange(definition.key, e.currentTarget.value)} type="text" value={String(settingValue ?? '')} /> - + {isDefined(error) && error !== '' && ( + + + {error} + + } + /> + )} + )} ); diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx index 719a08495fc..1d4a0e36426 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/AlmSpecificForm.tsx @@ -17,14 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { FlagMessage, InputField, Note, SubHeading, Switch } from 'design-system'; +import { FlagMessage, InputField, Note, RequiredIcon, SubHeading, Switch } from 'design-system'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import withAvailableFeatures, { WithAvailableFeaturesProps, } from '../../../../app/components/available-features/withAvailableFeatures'; import DocumentationLink from '../../../../components/common/DocumentationLink'; -import MandatoryFieldMarker from '../../../../components/ui/MandatoryFieldMarker'; import { ALM_DOCUMENTATION_PATHS } from '../../../../helpers/constants'; import { translate } from '../../../../helpers/l10n'; import { convertGithubApiUrlToLink, stripTrailingSlash } from '../../../../helpers/urls'; @@ -96,7 +95,7 @@ function renderLabel(props: LabelProps) { return ( ); } diff --git a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx index 3cbee5c857d..47e215da6fd 100644 --- a/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/settings/components/pullRequestDecorationBinding/PRDecorationBindingRenderer.tsx @@ -24,6 +24,7 @@ import { FlagMessage, Link, Note, + RequiredIcon, Spinner, SubHeading, SubTitle, @@ -31,7 +32,6 @@ import { import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import AlmSettingsInstanceSelector from '../../../../components/devops-platform/AlmSettingsInstanceSelector'; -import MandatoryFieldMarker from '../../../../components/ui/MandatoryFieldMarker'; import MandatoryFieldsExplanation from '../../../../components/ui/MandatoryFieldsExplanation'; import { translate } from '../../../../helpers/l10n'; import { getGlobalSettingsUrl } from '../../../../helpers/urls'; @@ -130,7 +130,7 @@ export default function PRDecorationBindingRenderer(props: PRDecorationBindingRe
diff --git a/server/sonar-web/src/main/js/components/icons/ChartLegendIcon.tsx b/server/sonar-web/src/main/js/components/activity-graph/ChartLegend.tsx similarity index 96% rename from server/sonar-web/src/main/js/components/icons/ChartLegendIcon.tsx rename to server/sonar-web/src/main/js/components/activity-graph/ChartLegend.tsx index f6e7ef1a39c..b07e5c0d84d 100644 --- a/server/sonar-web/src/main/js/components/icons/ChartLegendIcon.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/ChartLegend.tsx @@ -27,7 +27,7 @@ interface Props { index: number; } -export function ChartLegendIcon({ index, className }: Props) { +export function ChartLegend({ index, className }: Readonly) { const theme = useTheme() as Theme; return ( diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendItem.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendItem.tsx index d8f4361c4f5..58767ea47ed 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendItem.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsLegendItem.tsx @@ -29,8 +29,8 @@ import { themeColor, } from 'design-system'; import * as React from 'react'; -import { ChartLegendIcon } from '../../components/icons/ChartLegendIcon'; import { translateWithParameters } from '../../helpers/l10n'; +import { ChartLegend } from './ChartLegend'; interface Props { className?: string; @@ -61,7 +61,7 @@ export function GraphsLegendItem({ {showWarning ? ( ) : ( - + )} {name} diff --git a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContent.tsx b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContent.tsx index 6ed3cb4c8c1..8617d043ed5 100644 --- a/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContent.tsx +++ b/server/sonar-web/src/main/js/components/activity-graph/GraphsTooltipsContent.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import { ChartLegendIcon } from '../../components/icons/ChartLegendIcon'; +import { ChartLegend } from './ChartLegend'; interface Props { name: string; @@ -31,7 +31,7 @@ export default function GraphsTooltipsContent({ name, index, translatedName, val return ( - + {value} {translatedName} diff --git a/server/sonar-web/src/main/js/components/common/Link.tsx b/server/sonar-web/src/main/js/components/common/Link.tsx index 56f6dbade96..b6685c4447d 100644 --- a/server/sonar-web/src/main/js/components/common/Link.tsx +++ b/server/sonar-web/src/main/js/components/common/Link.tsx @@ -18,11 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as Echoes from '@sonarsource/echoes-react'; +import { OpenNewTabIcon } from 'design-system'; import * as React from 'react'; import { Link as ReactRouterDomLink, LinkProps as ReactRouterDomLinkProps } from 'react-router-dom'; import { isWebUri } from 'valid-url'; import { translate } from '../../helpers/l10n'; -import DetachIcon from '../icons/DetachIcon'; type OriginalLinkProps = ReactRouterDomLinkProps & React.RefAttributes; @@ -41,8 +41,6 @@ export interface LinkProps extends OriginalLinkProps { size?: number; } -const DEFAULT_ICON_SIZE = 14; - function Link({ children, size, ...props }: LinkProps, ref: React.ForwardedRef) { if (typeof props.to === 'string' && isWebUri(props.to)) { // The new React Router DOM's component no longer supports external links. @@ -56,11 +54,7 @@ function Link({ children, size, ...props }: LinkProps, ref: React.ForwardedRef {anchorProps.target === '_blank' && ( - + )} {children} diff --git a/server/sonar-web/src/main/js/components/common/MetaLink.tsx b/server/sonar-web/src/main/js/components/common/MetaLink.tsx index 86ecb5ce07c..752d47a2a8e 100644 --- a/server/sonar-web/src/main/js/components/common/MetaLink.tsx +++ b/server/sonar-web/src/main/js/components/common/MetaLink.tsx @@ -17,21 +17,19 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import styled from '@emotion/styled'; -import { CloseIcon, InputField, InteractiveIcon, Link } from 'design-system'; +import { LinkStandalone } from '@sonarsource/echoes-react'; +import { CloseIcon, InputField, InteractiveIcon } from 'design-system'; import React, { useState } from 'react'; import isValidUri from '../../app/utils/isValidUri'; import { translate } from '../../helpers/l10n'; import { getLinkName } from '../../helpers/projectLinks'; import { ProjectLink } from '../../types/types'; -import ProjectLinkIcon from '../icons/ProjectLinkIcon'; interface Props { - iconOnly?: boolean; link: ProjectLink; } -export default function MetaLink({ iconOnly, link }: Readonly) { +export default function MetaLink({ link }: Readonly) { const [expanded, setExpanded] = useState(false); const handleClick = (event: React.MouseEvent) => { @@ -51,14 +49,14 @@ export default function MetaLink({ iconOnly, link }: Readonly) { const isValid = isValidUri(link.url); return (
  • - } + shouldPreventDefault={!isValid} + to={link.url} > - {!iconOnly && linkTitle} - + {linkTitle} + {expanded && (
    @@ -74,19 +72,3 @@ export default function MetaLink({ iconOnly, link }: Readonly) {
  • ); } - -/* - * Override the spacing to make it smaller - * 1rem = 16px for the icon width - * + - * 0.5 rem = margin '2' - */ -const StyledLink = styled(Link)` - margin-left: 1.5rem; - - & > svg, - & > img { - margin-right: 0.5rem; - margin-left: -1.5rem; - } -`; diff --git a/server/sonar-web/src/main/js/components/controls/ValidationInput.tsx b/server/sonar-web/src/main/js/components/controls/ValidationInput.tsx deleted file mode 100644 index 5c8665ee692..00000000000 --- a/server/sonar-web/src/main/js/components/controls/ValidationInput.tsx +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { translate } from '../../helpers/l10n'; -import AlertErrorIcon from '../icons/AlertErrorIcon'; -import AlertSuccessIcon from '../icons/AlertSuccessIcon'; -import MandatoryFieldMarker from '../ui/MandatoryFieldMarker'; -import HelpTooltip from './HelpTooltip'; - -export interface ValidationInputProps { - description?: React.ReactNode; - children: React.ReactNode; - className?: string; - error?: string; - errorPlacement?: ValidationInputErrorPlacement; - help?: string; - labelHtmlFor?: string; - isInvalid: boolean; - isValid: boolean; - label?: React.ReactNode; - required?: boolean; - showValidIcon?: boolean; -} - -export enum ValidationInputErrorPlacement { - Right, - Bottom, -} - -export default function ValidationInput(props: ValidationInputProps) { - const { - children, - className, - description, - error, - errorPlacement = ValidationInputErrorPlacement.Right, - help, - labelHtmlFor, - isInvalid, - isValid, - label, - required, - showValidIcon = true, - } = props; - - const hasError = isInvalid && error !== undefined; - - let childrenWithStatus: React.ReactNode; - - if (errorPlacement === ValidationInputErrorPlacement.Right) { - childrenWithStatus = ( - <> - {children} - {showValidIcon && isValid && ( - - )} - {isInvalid && } - {hasError && {error}} - - ); - } else { - childrenWithStatus = ( - <> - {children} - {showValidIcon && isValid && ( - - )} -
    - {isInvalid && } - {hasError && {error}} -
    - - ); - } - - return ( -
    - {labelHtmlFor && label && ( - - )} -
    {childrenWithStatus}
    - {description &&
    {description}
    } -
    - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/BranchLikeIcon.tsx b/server/sonar-web/src/main/js/components/icon-mappers/BranchLikeIcon.tsx similarity index 89% rename from server/sonar-web/src/main/js/components/icons/BranchLikeIcon.tsx rename to server/sonar-web/src/main/js/components/icon-mappers/BranchLikeIcon.tsx index e1b419eb713..5cea6b31037 100644 --- a/server/sonar-web/src/main/js/components/icons/BranchLikeIcon.tsx +++ b/server/sonar-web/src/main/js/components/icon-mappers/BranchLikeIcon.tsx @@ -17,9 +17,8 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { BranchIcon, MainBranchIcon, PullRequestIcon, ThemeColors } from 'design-system'; +import { BranchIcon, IconProps, MainBranchIcon, PullRequestIcon, ThemeColors } from 'design-system'; import * as React from 'react'; -import { IconProps } from '../../components/icons/Icon'; import { isMainBranch, isPullRequest } from '../../helpers/branch-like'; import { BranchLike } from '../../types/branch-like'; @@ -28,7 +27,7 @@ export interface BranchLikeIconProps extends Omit { fill?: ThemeColors; } -export default function BranchLikeIcon({ branchLike, ...props }: BranchLikeIconProps) { +export default function BranchLikeIcon({ branchLike, ...props }: Readonly) { if (isPullRequest(branchLike)) { return ; } else if (isMainBranch(branchLike)) { diff --git a/server/sonar-web/src/main/js/components/icons/IssueStatusIcon.tsx b/server/sonar-web/src/main/js/components/icon-mappers/IssueStatusIcon.tsx similarity index 98% rename from server/sonar-web/src/main/js/components/icons/IssueStatusIcon.tsx rename to server/sonar-web/src/main/js/components/icon-mappers/IssueStatusIcon.tsx index 825cc7ead46..1bcdf1b3f67 100644 --- a/server/sonar-web/src/main/js/components/icons/IssueStatusIcon.tsx +++ b/server/sonar-web/src/main/js/components/icon-mappers/IssueStatusIcon.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { + IconProps, StatusConfirmedIcon, StatusOpenIcon, StatusReopenedIcon, @@ -26,7 +27,6 @@ import { import * as React from 'react'; import { IssueStatus } from '../../types/issues'; import { Dict } from '../../types/types'; -import { IconProps } from './Icon'; interface Props extends IconProps { issueStatus: IssueStatus; diff --git a/server/sonar-web/src/main/js/components/icon-mappers/IssueTypeIcon.tsx b/server/sonar-web/src/main/js/components/icon-mappers/IssueTypeIcon.tsx index 00704eb9f64..28762ca30f5 100644 --- a/server/sonar-web/src/main/js/components/icon-mappers/IssueTypeIcon.tsx +++ b/server/sonar-web/src/main/js/components/icon-mappers/IssueTypeIcon.tsx @@ -17,17 +17,12 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { useTheme } from '@emotion/react'; -import styled from '@emotion/styled'; -import classNames from 'classnames'; import { BugIcon, CodeSmellIcon, IconProps, SecurityHotspotIcon, VulnerabilityIcon, - themeColor, - themeContrast, } from 'design-system'; import React from 'react'; import { IssueType } from '../../types/issues'; @@ -62,22 +57,3 @@ export default function IssueTypeIcon({ type, ...iconProps }: Props) { return null; } } - -export function IssueTypeCircleIcon({ className, type, ...iconProps }: Props) { - const theme = useTheme(); - return ( - - - - ); -} - -const CircleIconContainer = styled.div` - background: ${themeColor('issueTypeIcon')}; - border-radius: 100%; -`; diff --git a/server/sonar-web/src/main/js/components/ui/MandatoryFieldMarker.tsx b/server/sonar-web/src/main/js/components/icon-mappers/SeverityIcon.tsx similarity index 51% rename from server/sonar-web/src/main/js/components/ui/MandatoryFieldMarker.tsx rename to server/sonar-web/src/main/js/components/icon-mappers/SeverityIcon.tsx index 58131d4baa4..8fd49b16a26 100644 --- a/server/sonar-web/src/main/js/components/ui/MandatoryFieldMarker.tsx +++ b/server/sonar-web/src/main/js/components/icon-mappers/SeverityIcon.tsx @@ -17,21 +17,38 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import classNames from 'classnames'; +import { + IconProps, + SeverityBlockerIcon, + SeverityCriticalIcon, + SeverityInfoIcon, + SeverityMajorIcon, + SeverityMinorIcon, +} from 'design-system'; import * as React from 'react'; import { translate } from '../../helpers/l10n'; +import { isDefined } from '../../helpers/types'; +import { Dict } from '../../types/types'; -export interface MandatoryFieldMarkerProps { - className?: string; +interface Props extends IconProps { + severity: string | null | undefined; } -export default function MandatoryFieldMarker({ className }: MandatoryFieldMarkerProps) { - return ( - - * - - ); +const severityIcons: Dict<(props: IconProps) => React.ReactElement> = { + blocker: SeverityBlockerIcon, + critical: SeverityCriticalIcon, + major: SeverityMajorIcon, + minor: SeverityMinorIcon, + info: SeverityInfoIcon, +}; + +export default function SeverityIcon({ severity, ...iconProps }: Omit) { + if (!isDefined(severity)) { + return null; + } + + const DesiredIcon = severityIcons[severity.toLowerCase()]; + return DesiredIcon ? ( + + ) : null; } diff --git a/server/sonar-web/src/main/js/components/icons/SoftwareImpactSeverityIcon.tsx b/server/sonar-web/src/main/js/components/icon-mappers/SoftwareImpactSeverityIcon.tsx similarity index 98% rename from server/sonar-web/src/main/js/components/icons/SoftwareImpactSeverityIcon.tsx rename to server/sonar-web/src/main/js/components/icon-mappers/SoftwareImpactSeverityIcon.tsx index 6a5f4c40b05..6e3102a68ae 100644 --- a/server/sonar-web/src/main/js/components/icons/SoftwareImpactSeverityIcon.tsx +++ b/server/sonar-web/src/main/js/components/icon-mappers/SoftwareImpactSeverityIcon.tsx @@ -18,6 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import { + IconProps, SoftwareImpactSeverityHighIcon, SoftwareImpactSeverityLowIcon, SoftwareImpactSeverityMediumIcon, @@ -26,7 +27,6 @@ import * as React from 'react'; import { translate } from '../../helpers/l10n'; import { SoftwareImpactSeverity } from '../../types/clean-code-taxonomy'; import { Dict } from '../../types/types'; -import { IconProps } from './Icon'; interface Props extends IconProps { severity: string | null | undefined; diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/BranchLikeIcon-test.tsx b/server/sonar-web/src/main/js/components/icon-mappers/__tests__/BranchLikeIcon-test.tsx similarity index 94% rename from server/sonar-web/src/main/js/components/icons/__tests__/BranchLikeIcon-test.tsx rename to server/sonar-web/src/main/js/components/icon-mappers/__tests__/BranchLikeIcon-test.tsx index fe4608b53ec..f8a372fca84 100644 --- a/server/sonar-web/src/main/js/components/icons/__tests__/BranchLikeIcon-test.tsx +++ b/server/sonar-web/src/main/js/components/icon-mappers/__tests__/BranchLikeIcon-test.tsx @@ -20,7 +20,7 @@ import { render } from '@testing-library/react'; import * as React from 'react'; import { mockBranch, mockPullRequest } from '../../../helpers/mocks/branch-like'; -import BranchLikeIcon, { BranchLikeIconProps } from '../BranchLikeIcon'; +import BranchLikeIcon, { BranchLikeIconProps } from '../../icon-mappers/BranchLikeIcon'; it('should render branch icon correctly', () => { renderBranchLikeIcon({ branchLike: mockBranch() }); diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/BranchLikeIcon-test.tsx.snap b/server/sonar-web/src/main/js/components/icon-mappers/__tests__/__snapshots__/BranchLikeIcon-test.tsx.snap similarity index 100% rename from server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/BranchLikeIcon-test.tsx.snap rename to server/sonar-web/src/main/js/components/icon-mappers/__tests__/__snapshots__/BranchLikeIcon-test.tsx.snap diff --git a/server/sonar-web/src/main/js/components/icons/AlertErrorIcon.tsx b/server/sonar-web/src/main/js/components/icons/AlertErrorIcon.tsx deleted file mode 100644 index e493b7cc8a7..00000000000 --- a/server/sonar-web/src/main/js/components/icons/AlertErrorIcon.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { colors } from '../../app/theme'; -import Icon, { IconProps } from './Icon'; - -export default function AlertErrorIcon({ fill, ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/AlertSuccessIcon.tsx b/server/sonar-web/src/main/js/components/icons/AlertSuccessIcon.tsx deleted file mode 100644 index 2049296b113..00000000000 --- a/server/sonar-web/src/main/js/components/icons/AlertSuccessIcon.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { colors } from '../../app/theme'; -import Icon, { IconProps } from './Icon'; - -export default function AlertSuccessIcon({ fill, ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/AlertWarnIcon.tsx b/server/sonar-web/src/main/js/components/icons/AlertWarnIcon.tsx deleted file mode 100644 index a1edfb4e584..00000000000 --- a/server/sonar-web/src/main/js/components/icons/AlertWarnIcon.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { colors } from '../../app/theme'; -import Icon, { IconProps } from './Icon'; - -export default function AlertWarnIcon({ fill, ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/BackIcon.tsx b/server/sonar-web/src/main/js/components/icons/BackIcon.tsx deleted file mode 100644 index 8f09280f05a..00000000000 --- a/server/sonar-web/src/main/js/components/icons/BackIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function BackIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/BugIcon.tsx b/server/sonar-web/src/main/js/components/icons/BugIcon.tsx deleted file mode 100644 index 1fa32459fee..00000000000 --- a/server/sonar-web/src/main/js/components/icons/BugIcon.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function BugIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/BugTrackerIcon.tsx b/server/sonar-web/src/main/js/components/icons/BugTrackerIcon.tsx deleted file mode 100644 index 2e2f65a503c..00000000000 --- a/server/sonar-web/src/main/js/components/icons/BugTrackerIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function BugTrackerIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/BulletListIcon.tsx b/server/sonar-web/src/main/js/components/icons/BulletListIcon.tsx deleted file mode 100644 index ee6572beae7..00000000000 --- a/server/sonar-web/src/main/js/components/icons/BulletListIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function BulletListIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/CalendarIcon.tsx b/server/sonar-web/src/main/js/components/icons/CalendarIcon.tsx deleted file mode 100644 index efe5a3608c0..00000000000 --- a/server/sonar-web/src/main/js/components/icons/CalendarIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function CalendarIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/ChevronDownIcon.tsx b/server/sonar-web/src/main/js/components/icons/ChevronDownIcon.tsx deleted file mode 100644 index d4d3a091b2f..00000000000 --- a/server/sonar-web/src/main/js/components/icons/ChevronDownIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function ChevronDownIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/ChevronRightIcon.tsx b/server/sonar-web/src/main/js/components/icons/ChevronRightIcon.tsx deleted file mode 100644 index 2e12396135f..00000000000 --- a/server/sonar-web/src/main/js/components/icons/ChevronRightIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function ChevronRightIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/ClearIcon.tsx b/server/sonar-web/src/main/js/components/icons/ClearIcon.tsx deleted file mode 100644 index 857fa46fb5d..00000000000 --- a/server/sonar-web/src/main/js/components/icons/ClearIcon.tsx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export interface ClearIconProps extends IconProps { - thin?: boolean; -} - -export default function ClearIcon({ fill = 'currentColor', thin, ...iconProps }: ClearIconProps) { - return ( - - {thin ? ( - - ) : ( - - )} - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/CodeSmellIcon.tsx b/server/sonar-web/src/main/js/components/icons/CodeSmellIcon.tsx deleted file mode 100644 index 0c5b5505341..00000000000 --- a/server/sonar-web/src/main/js/components/icons/CodeSmellIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function CodeSmellIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/CollapseIcon.tsx b/server/sonar-web/src/main/js/components/icons/CollapseIcon.tsx deleted file mode 100644 index b8d6abe52ae..00000000000 --- a/server/sonar-web/src/main/js/components/icons/CollapseIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function CollapseIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/ContinuousIntegrationIcon.tsx b/server/sonar-web/src/main/js/components/icons/ContinuousIntegrationIcon.tsx deleted file mode 100644 index 533e88c68db..00000000000 --- a/server/sonar-web/src/main/js/components/icons/ContinuousIntegrationIcon.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function ContinuousIntegrationIcon({ - fill = 'currentColor', - ...iconProps -}: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/DeleteIcon.tsx b/server/sonar-web/src/main/js/components/icons/DeleteIcon.tsx deleted file mode 100644 index 32a31304069..00000000000 --- a/server/sonar-web/src/main/js/components/icons/DeleteIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function DeleteIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/DetachIcon.tsx b/server/sonar-web/src/main/js/components/icons/DetachIcon.tsx deleted file mode 100644 index fc6c112ef78..00000000000 --- a/server/sonar-web/src/main/js/components/icons/DetachIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function DetachIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/DropdownIcon.tsx b/server/sonar-web/src/main/js/components/icons/DropdownIcon.tsx deleted file mode 100644 index 204a54d0c83..00000000000 --- a/server/sonar-web/src/main/js/components/icons/DropdownIcon.tsx +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -interface DropdownIconProps { - turned?: boolean; -} - -export default function DropdownIcon({ - fill = 'currentColor', - size = 16, - turned = false, - ...iconProps -}: IconProps & DropdownIconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/EditIcon.tsx b/server/sonar-web/src/main/js/components/icons/EditIcon.tsx deleted file mode 100644 index 48fd11b4869..00000000000 --- a/server/sonar-web/src/main/js/components/icons/EditIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function EditIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/EllipsisIcon.tsx b/server/sonar-web/src/main/js/components/icons/EllipsisIcon.tsx deleted file mode 100644 index a309ac54f5a..00000000000 --- a/server/sonar-web/src/main/js/components/icons/EllipsisIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function EllipsisIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/ExpandIcon.tsx b/server/sonar-web/src/main/js/components/icons/ExpandIcon.tsx deleted file mode 100644 index bdae20c5da6..00000000000 --- a/server/sonar-web/src/main/js/components/icons/ExpandIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function ExpandIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/FavoriteIcon.tsx b/server/sonar-web/src/main/js/components/icons/FavoriteIcon.tsx deleted file mode 100644 index 5a47faeec29..00000000000 --- a/server/sonar-web/src/main/js/components/icons/FavoriteIcon.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ -import classNames from 'classnames'; -import * as React from 'react'; -import { colors } from '../../app/theme'; -import Icon, { IconProps } from './Icon'; - -interface Props extends IconProps { - favorite: boolean; -} - -export default function FavoriteIcon({ className, favorite, fill, ...iconProps }: Props) { - return ( - - - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/GroupIcon.tsx b/server/sonar-web/src/main/js/components/icons/GroupIcon.tsx deleted file mode 100644 index dfac1c0d591..00000000000 --- a/server/sonar-web/src/main/js/components/icons/GroupIcon.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { colors } from '../../app/theme'; -import Icon, { IconProps } from './Icon'; - -export default function GroupIcon({ fill, size = 36, ...iconProps }: IconProps) { - return ( - - - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/HistoryIcon.tsx b/server/sonar-web/src/main/js/components/icons/HistoryIcon.tsx deleted file mode 100644 index 23437591789..00000000000 --- a/server/sonar-web/src/main/js/components/icons/HistoryIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function HistoryIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/HouseIcon.tsx b/server/sonar-web/src/main/js/components/icons/HouseIcon.tsx deleted file mode 100644 index bf3a9361e79..00000000000 --- a/server/sonar-web/src/main/js/components/icons/HouseIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function HouseIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/Icon.tsx b/server/sonar-web/src/main/js/components/icons/Icon.tsx deleted file mode 100644 index 16019a6fb75..00000000000 --- a/server/sonar-web/src/main/js/components/icons/Icon.tsx +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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. - */ -import { uniqueId } from 'lodash'; -import * as React from 'react'; - -export interface IconProps extends React.HTMLAttributes { - className?: string; - fill?: string; - size?: number; - label?: React.ReactNode; - description?: React.ReactNode; -} - -interface Props extends React.HTMLAttributes { - children: React.ReactNode; - className?: string; - size?: number; - style?: React.CSSProperties; - label?: React.ReactNode; - description?: React.ReactNode; - - // try to avoid using these: - width?: number; - height?: number; - viewBox?: string; -} - -export default function Icon({ - children, - className, - size = 16, - style, - height = size, - width = size, - viewBox = '0 0 16 16', - label, - description, - 'aria-hidden': hidden, - ...iconProps -}: Props) { - const id = uniqueId('icon'); - return ( - - {label && !hidden && {label}} - {description && !hidden && {description}} - {children} - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/InfoIcon.tsx b/server/sonar-web/src/main/js/components/icons/InfoIcon.tsx deleted file mode 100644 index 2b729e0e4e3..00000000000 --- a/server/sonar-web/src/main/js/components/icons/InfoIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function InfoIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/IssueIcon.tsx b/server/sonar-web/src/main/js/components/icons/IssueIcon.tsx deleted file mode 100644 index f95988e9625..00000000000 --- a/server/sonar-web/src/main/js/components/icons/IssueIcon.tsx +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { IssueType } from '../../types/types'; -import BugIcon from './BugIcon'; -import CodeSmellIcon from './CodeSmellIcon'; -import { IconProps } from './Icon'; -import SecurityHotspotIcon from './SecurityHotspotIcon'; -import VulnerabilityIcon from './VulnerabilityIcon'; - -interface Props extends IconProps { - type: IssueType; -} - -export default function IssueIcon({ type, ...iconProps }: Props) { - switch (type) { - case 'BUG': - return ; - case 'VULNERABILITY': - return ; - case 'CODE_SMELL': - return ; - case 'SECURITY_HOTSPOT': - return ; - default: - return null; - } -} diff --git a/server/sonar-web/src/main/js/components/icons/IssueTypeIcon.tsx b/server/sonar-web/src/main/js/components/icons/IssueTypeIcon.tsx deleted file mode 100644 index 439691c41a1..00000000000 --- a/server/sonar-web/src/main/js/components/icons/IssueTypeIcon.tsx +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { IssueType } from '../../types/types'; -import { IconProps } from './Icon'; -import IssueIcon from './IssueIcon'; - -export interface Props extends IconProps { - query: string; -} - -export default function IssueTypeIcon({ query, ...iconProps }: Props) { - let type: IssueType; - - switch (query.toLowerCase()) { - case 'bug': - case 'bugs': - case 'new_bugs': - type = 'BUG'; - break; - case 'vulnerability': - case 'vulnerabilities': - case 'new_vulnerabilities': - type = 'VULNERABILITY'; - break; - case 'code_smell': - case 'code_smells': - case 'new_code_smells': - type = 'CODE_SMELL'; - break; - case 'security_hotspot': - case 'security_hotspots': - case 'new_security_hotspots': - type = 'SECURITY_HOTSPOT'; - break; - default: - return null; - } - - return ; -} diff --git a/server/sonar-web/src/main/js/components/icons/LinkIcon.tsx b/server/sonar-web/src/main/js/components/icons/LinkIcon.tsx deleted file mode 100644 index 52491e88950..00000000000 --- a/server/sonar-web/src/main/js/components/icons/LinkIcon.tsx +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function LinkIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/LockIcon.tsx b/server/sonar-web/src/main/js/components/icons/LockIcon.tsx deleted file mode 100644 index de59aeb559b..00000000000 --- a/server/sonar-web/src/main/js/components/icons/LockIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function LockIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/MinimizeIcon.tsx b/server/sonar-web/src/main/js/components/icons/MinimizeIcon.tsx deleted file mode 100644 index c0d928c4d48..00000000000 --- a/server/sonar-web/src/main/js/components/icons/MinimizeIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function MinimizeIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/OpenCloseIcon.tsx b/server/sonar-web/src/main/js/components/icons/OpenCloseIcon.tsx deleted file mode 100644 index 403a32390b3..00000000000 --- a/server/sonar-web/src/main/js/components/icons/OpenCloseIcon.tsx +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import ChevronDownIcon from './ChevronDownIcon'; -import ChevronRightIcon from './ChevronRightIcon'; -import { IconProps } from './Icon'; - -interface Props extends IconProps { - open: boolean; -} - -export default function OpenCloseIcon({ open, ...iconProps }: Props) { - return open ? : ; -} diff --git a/server/sonar-web/src/main/js/components/icons/PendingIcon.tsx b/server/sonar-web/src/main/js/components/icons/PendingIcon.tsx deleted file mode 100644 index cfed18edf71..00000000000 --- a/server/sonar-web/src/main/js/components/icons/PendingIcon.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { colors } from '../../app/theme'; -import Icon, { IconProps } from './Icon'; - -export default function PendingIcon({ fill, ...iconProps }: IconProps) { - return ( - - - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/PlusCircleIcon.tsx b/server/sonar-web/src/main/js/components/icons/PlusCircleIcon.tsx deleted file mode 100644 index 217874c5d6a..00000000000 --- a/server/sonar-web/src/main/js/components/icons/PlusCircleIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function PlusCircleIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/ProjectLinkIcon.tsx b/server/sonar-web/src/main/js/components/icons/ProjectLinkIcon.tsx deleted file mode 100644 index e53096d3e0e..00000000000 --- a/server/sonar-web/src/main/js/components/icons/ProjectLinkIcon.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ -import { - FileIcon, - HomeIcon, - LinkExternalIcon, - IconProps as MIUIIconProps, - PulseIcon, - SyncIcon, -} from '@primer/octicons-react'; -import React, { FC } from 'react'; - -interface ProjectLinkIconProps { - type: string; -} - -export default function ProjectLinkIcon({ type, ...iconProps }: ProjectLinkIconProps) { - const getIcon = (): FC> => { - switch (type) { - case 'issue': - return PulseIcon; - case 'homepage': - return HomeIcon; - case 'ci': - return SyncIcon; - case 'scm': - return FileIcon; - default: - return LinkExternalIcon; - } - }; - - const Icon = getIcon(); - - return ; -} diff --git a/server/sonar-web/src/main/js/components/icons/PullRequestIcon.tsx b/server/sonar-web/src/main/js/components/icons/PullRequestIcon.tsx deleted file mode 100644 index 46d642dc9b3..00000000000 --- a/server/sonar-web/src/main/js/components/icons/PullRequestIcon.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { colors } from '../../app/theme'; -import Icon, { IconProps } from './Icon'; - -export default function PullRequestIcon({ fill, ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx b/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx deleted file mode 100644 index c0d4d4609fc..00000000000 --- a/server/sonar-web/src/main/js/components/icons/QualifierIcon.tsx +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { colors } from '../../app/theme'; -import { translate } from '../../helpers/l10n'; -import { Dict } from '../../types/types'; -import Icon, { IconProps } from './Icon'; - -const qualifierIcons: Dict<(props: IconProps) => React.ReactElement> = { - app: ApplicationIcon, - dev: DeveloperIcon, - dir: DirectoryIcon, - fil: FileIcon, - svw: SubPortfolioIcon, - trk: ProjectIcon, - uts: UnitTestIcon, - vw: PortfolioIcon, -}; - -interface QualifierIconProps extends IconProps { - className?: string; - fill?: string; - qualifier: string | null | undefined; -} - -export default function QualifierIcon({ - qualifier, - className, - fill, - ...props -}: QualifierIconProps) { - if (!qualifier) { - return null; - } - - const FoundIcon = qualifierIcons[qualifier.toLowerCase()]; - const ariaLabel = qualifier ? translate(`qualifier.${qualifier}`) : undefined; - return FoundIcon ? ( - - ) : null; -} - -function ApplicationIcon({ fill, label: ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} - -function DeveloperIcon({ fill, label: ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} - -function DirectoryIcon({ fill, label: ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} - -function FileIcon({ fill, label: ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} - -function PortfolioIcon({ fill, label: ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} - -function ProjectIcon({ fill, label: ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} - -function SubPortfolioIcon({ fill, label: ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} - -function UnitTestIcon({ fill, label: ariaLabel, ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/RecommendedIcon.tsx b/server/sonar-web/src/main/js/components/icons/RecommendedIcon.tsx deleted file mode 100644 index b568a2a5a90..00000000000 --- a/server/sonar-web/src/main/js/components/icons/RecommendedIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function RecommendedIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/SCMIcon.tsx b/server/sonar-web/src/main/js/components/icons/SCMIcon.tsx deleted file mode 100644 index df5704f5779..00000000000 --- a/server/sonar-web/src/main/js/components/icons/SCMIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function SCMIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/SearchIcon.tsx b/server/sonar-web/src/main/js/components/icons/SearchIcon.tsx deleted file mode 100644 index 5c1c3d1b4f7..00000000000 --- a/server/sonar-web/src/main/js/components/icons/SearchIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function SearchIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/SecurityHotspotIcon.tsx b/server/sonar-web/src/main/js/components/icons/SecurityHotspotIcon.tsx deleted file mode 100644 index f477ba1fe7b..00000000000 --- a/server/sonar-web/src/main/js/components/icons/SecurityHotspotIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function SecurityHotspotIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/SettingsIcon.tsx b/server/sonar-web/src/main/js/components/icons/SettingsIcon.tsx deleted file mode 100644 index 2d284582170..00000000000 --- a/server/sonar-web/src/main/js/components/icons/SettingsIcon.tsx +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function SettingsIcon({ - fill = 'currentColor', - size = 14, - ...iconProps -}: IconProps) { - return ( - - - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx b/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx deleted file mode 100644 index db88947efb2..00000000000 --- a/server/sonar-web/src/main/js/components/icons/SeverityIcon.tsx +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { colors } from '../../app/theme'; -import { translate } from '../../helpers/l10n'; -import { Dict } from '../../types/types'; -import Icon, { IconProps } from './Icon'; - -interface Props extends IconProps { - severity: string | null | undefined; -} - -const severityIcons: Dict<(props: IconProps) => React.ReactElement> = { - blocker: BlockerSeverityIcon, - critical: CriticalSeverityIcon, - major: MajorSeverityIcon, - minor: MinorSeverityIcon, - info: InfoSeverityIcon, -}; - -export default function SeverityIcon({ severity, ...iconProps }: Omit) { - if (!severity) { - return null; - } - - const DesiredIcon = severityIcons[severity.toLowerCase()]; - return DesiredIcon ? ( - - ) : null; -} - -function BlockerSeverityIcon(iconProps: IconProps) { - return ( - - - - ); -} - -function CriticalSeverityIcon(iconProps: IconProps) { - return ( - - - - ); -} - -function MajorSeverityIcon(iconProps: IconProps) { - return ( - - - - ); -} - -function MinorSeverityIcon(iconProps: IconProps) { - return ( - - - - ); -} - -function InfoSeverityIcon(iconProps: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/TagsIcon.tsx b/server/sonar-web/src/main/js/components/icons/TagsIcon.tsx deleted file mode 100644 index 889c0faa610..00000000000 --- a/server/sonar-web/src/main/js/components/icons/TagsIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function TagsIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/VulnerabilityIcon.tsx b/server/sonar-web/src/main/js/components/icons/VulnerabilityIcon.tsx deleted file mode 100644 index 2699cc74d9a..00000000000 --- a/server/sonar-web/src/main/js/components/icons/VulnerabilityIcon.tsx +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import Icon, { IconProps } from './Icon'; - -export default function VulnerabilityIcon({ fill = 'currentColor', ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/WarningIcon.tsx b/server/sonar-web/src/main/js/components/icons/WarningIcon.tsx deleted file mode 100644 index 73d1054ecaa..00000000000 --- a/server/sonar-web/src/main/js/components/icons/WarningIcon.tsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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. - */ -import * as React from 'react'; -import { colors } from '../../app/theme'; -import Icon, { IconProps } from './Icon'; - -export default function WarningIcon({ fill, ...iconProps }: IconProps) { - return ( - - - - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/Icon-test.tsx b/server/sonar-web/src/main/js/components/icons/__tests__/Icon-test.tsx deleted file mode 100644 index 7838fccda28..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/Icon-test.tsx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ -import { render } from '@testing-library/react'; -import * as React from 'react'; -import Icon, { IconProps } from '../Icon'; - -it('should render correctly', () => { - renderIcon(); - expect(document.body.innerHTML).toMatchSnapshot(); -}); - -function renderIcon(props: Partial = {}) { - return render( - - - , - ); -} diff --git a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/Icon-test.tsx.snap b/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/Icon-test.tsx.snap deleted file mode 100644 index 8ce95580571..00000000000 --- a/server/sonar-web/src/main/js/components/icons/__tests__/__snapshots__/Icon-test.tsx.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`should render correctly 1`] = `"
    "`; diff --git a/server/sonar-web/src/main/js/components/issue/components/SonarLintBadge.tsx b/server/sonar-web/src/main/js/components/issue/components/SonarLintBadge.tsx index 6641a8d47f7..ae18f700477 100644 --- a/server/sonar-web/src/main/js/components/issue/components/SonarLintBadge.tsx +++ b/server/sonar-web/src/main/js/components/issue/components/SonarLintBadge.tsx @@ -17,13 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { HoverLink } from 'design-system'; +import { LinkHighlight, LinkStandalone } from '@sonarsource/echoes-react'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { translate } from '../../../helpers/l10n'; import Link from '../../common/Link'; import Tooltip from '../../controls/Tooltip'; -import SonarLintIcon from '../../icons/SonarLintIcon'; +import { SonarLintLogo } from '../../logos/SonarLintLogo'; const SONARLINT_URL = 'https://www.sonarsource.com/products/sonarlint/features/connected-mode/?referrer=sonarqube-quick-fix'; @@ -42,14 +42,22 @@ function SonarLintBadgeFull() { overlay={translate('issue.quick_fix_available_with_sonarlint_no_link')} mouseLeaveDelay={0.5} > - - - {translate('issue.quick_fix')} - + + } + to={SONARLINT_URL} + className="sw-flex sw-items-center" + isExternal + hasExternalIcon + > + {translate('issue.quick_fix')} + ); } @@ -73,7 +81,7 @@ function SonarLintBadgeCompact() { mouseLeaveDelay={0.5} >
    - ) { + const id = uniqueId('icon'); return ( - + + {isDefined(description) && description !== '' && {description}} @@ -37,6 +61,6 @@ export default function SonarLintIcon(props: IconProps) { d="M392.6 244.9c-5.1-10.2-11.5-23-24.1-23-12.5 0-18.9 12.7-24.1 23-4.8 9.5-7.5 14.5-13.5 14.5s-8.7-5-13.5-14.5c-5.1-10.2-11.5-23-24.1-23s-18.9 12.7-24.1 23c-4.8 9.5-7.5 14.5-13.5 14.5s-8.7-5-13.5-14.5c-5.1-10.2-11.5-23-24.1-23s-18.9 12.7-24.1 23c-4.8 9.5-7.5 14.5-13.5 14.5s-8.7-5-13.5-14.5c-5.1-10.2-11.5-23-24.1-23-12.5 0-18.9 12.1-24 22.3 0 0-3.9 8.7-5.6 12.8-1.7 4.1-8.3 19.7-2.3 27.2 3.4 4.2 8.3-1.8 11.1-6.2 2.1-3.4 7.1-13.2 7.1-13.2 5.1-9.1 7.8-14 13.7-14 6 0 8.7 5 13.5 14.5 5.1 10.2 11.5 23 24.1 23 12.5 0 18.9-12.7 24.1-23 4.8-9.5 7.5-14.5 13.5-14.5s8.7 5 13.5 14.5c5.1 10.2 11.5 23 24.1 23 12.5 0 18.9-12.7 24.1-23 4.8-9.5 7.5-14.5 13.5-14.5s8.7 5 13.5 14.5c5.1 10.2 11.5 23 24.1 23s18.9-12.7 24.1-23c4.8-9.5 7.5-14.5 13.5-14.5s8.7 5 13.5 14.5c0 0 2.2 4.3 5.4 9.9 1.4 2.3 6.6 11.1 11.2 10.8 4.1-.3 5.6-13.3 1-24.7-3.1-7.6-7-16.4-7-16.4z" style={{ fill: '#cb2029' }} /> - + ); } diff --git a/server/sonar-web/src/main/js/components/permissions/GroupHolder.tsx b/server/sonar-web/src/main/js/components/permissions/GroupHolder.tsx index d2a1a874c6a..a1a7d38d5ad 100644 --- a/server/sonar-web/src/main/js/components/permissions/GroupHolder.tsx +++ b/server/sonar-web/src/main/js/components/permissions/GroupHolder.tsx @@ -17,14 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { Badge, ContentCell, TableRowInteractive } from 'design-system'; +import { Badge, ContentCell, TableRowInteractive, UserGroupIcon } from 'design-system'; import * as React from 'react'; import { translate } from '../../helpers/l10n'; import { isPermissionDefinitionGroup } from '../../helpers/permissions'; import { getBaseUrl } from '../../helpers/system'; import { Permissions } from '../../types/permissions'; import { PermissionDefinitions, PermissionGroup } from '../../types/types'; -import GroupIcon from '../icons/GroupIcon'; import PermissionCell from './PermissionCell'; import usePermissionChange from './usePermissionChange'; @@ -57,7 +56,7 @@ export default function GroupHolder(props: Props) {
    - +
    diff --git a/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx b/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx index 4074502f740..01f55e11098 100644 --- a/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx +++ b/server/sonar-web/src/main/js/components/shared/SeverityHelper.tsx @@ -17,23 +17,23 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { isEmpty } from 'lodash'; import * as React from 'react'; -import SeverityIcon from '../../components/icons/SeverityIcon'; import { translate } from '../../helpers/l10n'; +import SeverityIcon from '../icon-mappers/SeverityIcon'; interface Props { className?: string; - fill?: string; severity: string; } -export default function SeverityHelper({ className, severity, fill }: Props) { - if (!severity) { +export default function SeverityHelper({ className, severity }: Readonly) { + if (isEmpty(severity)) { return null; } return ( - + {translate('severity', severity)} ); diff --git a/server/sonar-web/src/main/js/components/shared/SoftwareImpactPill.tsx b/server/sonar-web/src/main/js/components/shared/SoftwareImpactPill.tsx index 04bc3626ef1..d4dca929885 100644 --- a/server/sonar-web/src/main/js/components/shared/SoftwareImpactPill.tsx +++ b/server/sonar-web/src/main/js/components/shared/SoftwareImpactPill.tsx @@ -24,7 +24,7 @@ import { FormattedMessage } from 'react-intl'; import { translate } from '../../helpers/l10n'; import { SoftwareImpactSeverity } from '../../types/clean-code-taxonomy'; import DocumentationTooltip from '../common/DocumentationTooltip'; -import SoftwareImpactSeverityIcon from '../icons/SoftwareImpactSeverityIcon'; +import SoftwareImpactSeverityIcon from '../icon-mappers/SoftwareImpactSeverityIcon'; export interface Props { className?: string; diff --git a/server/sonar-web/src/main/js/components/shared/StatusHelper.tsx b/server/sonar-web/src/main/js/components/shared/StatusHelper.tsx index 35c13b6905d..d1ac8b4f964 100644 --- a/server/sonar-web/src/main/js/components/shared/StatusHelper.tsx +++ b/server/sonar-web/src/main/js/components/shared/StatusHelper.tsx @@ -20,7 +20,7 @@ import * as React from 'react'; import { translate } from '../../helpers/l10n'; import { IssueStatus } from '../../types/issues'; -import IssueStatusIcon from '../icons/IssueStatusIcon'; +import IssueStatusIcon from '../icon-mappers/IssueStatusIcon'; interface Props { className?: string; diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentTitle.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentTitle.tsx index 7222ffafd16..c81a9328d26 100644 --- a/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentTitle.tsx +++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceComponentTitle.tsx @@ -18,8 +18,11 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import * as React from 'react'; -import QualifierIcon from '../../components/icons/QualifierIcon'; + +import { QualifierIcon } from 'design-system'; +import { translate } from '../../helpers/l10n'; import { collapsePath } from '../../helpers/path'; +import { isDefined } from '../../helpers/types'; import { ComponentDescriptor } from './context'; interface Props { @@ -31,8 +34,12 @@ export default function WorkspaceComponentTitle({ component, limited }: Props) { const { name = '—' } = component; return ( <> - {component.qualifier && ( - + {isDefined(component.qualifier) && ( + )} {limited ? collapsePath(name, 15) : name} diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceHeader.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceHeader.tsx index f4f9f5bb0a4..69b10941cca 100644 --- a/server/sonar-web/src/main/js/components/workspace/WorkspaceHeader.tsx +++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceHeader.tsx @@ -17,13 +17,18 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { IconProps, InteractiveIcon } from 'design-system'; +import styled from '@emotion/styled'; +import { + CloseIcon, + CollapseIcon, + ExpandIcon, + IconProps, + InteractiveIcon, + MinimizeIcon, + themeColor, +} from 'design-system'; import * as React from 'react'; import { DraggableCore, DraggableData } from 'react-draggable'; -import ClearIcon from '../../components/icons/ClearIcon'; -import CollapseIcon from '../../components/icons/CollapseIcon'; -import ExpandIcon from '../../components/icons/ExpandIcon'; -import MinimizeIcon from '../../components/icons/MinimizeIcon'; import { translate } from '../../helpers/l10n'; import Tooltip from '../controls/Tooltip'; @@ -44,14 +49,16 @@ export default class WorkspaceHeader extends React.PureComponent { render() { return ( -
    -
    {this.props.children}
    + + + {this.props.children} + -
    + -
    +
    { )}
    -
    + ); } } +const StyledWorkSpaceHeader = styled.header` + display: flex; + align-items: center; + justify-content: space-between; + box-sizing: border-box; + height: 1.875rem; + padding: 3px 10px; + font-weight: 300; + background-color: ${themeColor('workSpaceNavItemBackground')}; + color: ${themeColor('workSpaceNavItem')}; +`; + +const StyledWorkspaceName = styled.h6` + color: ${themeColor('workSpaceNavItem')}; +`; + +const StyledWorkspaceResizer = styled.div` + position: absolute; + top: 3px; + left: 50%; + width: 30px; + height: 5px; + margin-left: -15px; + background-image: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzBweCIgaGVpZ2h0PSI1cHgiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjQxNDIxOyI+PGc+PGcgaWQ9IkxheWVyMSI+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwwLDApIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMiIgaGVpZ2h0PSIyIiBzdHlsZT0iZmlsbDojNzc3O2ZpbGwtb3BhY2l0eTowLjU7Ii8+PC9nPjxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsNCwwKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgc3R5bGU9ImZpbGw6Izc3NztmaWxsLW9wYWNpdHk6MC41OyIvPjwvZz48ZyB0cmFuc2Zvcm09Im1hdHJpeCgxLDAsMCwxLDgsMCkiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjIiIHN0eWxlPSJmaWxsOiM3Nzc7ZmlsbC1vcGFjaXR5OjAuNTsiLz48L2c+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwxMiwwKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgc3R5bGU9ImZpbGw6Izc3NztmaWxsLW9wYWNpdHk6MC41OyIvPjwvZz48ZyB0cmFuc2Zvcm09Im1hdHJpeCgxLDAsMCwxLDE2LDApIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMiIgaGVpZ2h0PSIyIiBzdHlsZT0iZmlsbDojNzc3O2ZpbGwtb3BhY2l0eTowLjU7Ii8+PC9nPjxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMjAsMCkiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjIiIHN0eWxlPSJmaWxsOiM3Nzc7ZmlsbC1vcGFjaXR5OjAuNTsiLz48L2c+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwyNCwwKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgc3R5bGU9ImZpbGw6Izc3NztmaWxsLW9wYWNpdHk6MC41OyIvPjwvZz48ZyB0cmFuc2Zvcm09Im1hdHJpeCgxLDAsMCwxLDI4LDApIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMiIgaGVpZ2h0PSIyIiBzdHlsZT0iZmlsbDojNzc3O2ZpbGwtb3BhY2l0eTowLjU7Ii8+PC9nPjxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMCwzKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgc3R5bGU9ImZpbGw6Izc3NztmaWxsLW9wYWNpdHk6MC41OyIvPjwvZz48ZyB0cmFuc2Zvcm09Im1hdHJpeCgxLDAsMCwxLDQsMykiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjIiIHN0eWxlPSJmaWxsOiM3Nzc7ZmlsbC1vcGFjaXR5OjAuNTsiLz48L2c+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSw4LDMpIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMiIgaGVpZ2h0PSIyIiBzdHlsZT0iZmlsbDojNzc3O2ZpbGwtb3BhY2l0eTowLjU7Ii8+PC9nPjxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMTIsMykiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjIiIHN0eWxlPSJmaWxsOiM3Nzc7ZmlsbC1vcGFjaXR5OjAuNTsiLz48L2c+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwxNiwzKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgc3R5bGU9ImZpbGw6Izc3NztmaWxsLW9wYWNpdHk6MC41OyIvPjwvZz48ZyB0cmFuc2Zvcm09Im1hdHJpeCgxLDAsMCwxLDIwLDMpIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMiIgaGVpZ2h0PSIyIiBzdHlsZT0iZmlsbDojNzc3O2ZpbGwtb3BhY2l0eTowLjU7Ii8+PC9nPjxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMjQsMykiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjIiIHN0eWxlPSJmaWxsOiM3Nzc7ZmlsbC1vcGFjaXR5OjAuNTsiLz48L2c+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwyOCwzKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgc3R5bGU9ImZpbGw6Izc3NztmaWxsLW9wYWNpdHk6MC41OyIvPjwvZz48ZyB0cmFuc2Zvcm09Im1hdHJpeCgxLDAsMCwxLDAsMCkiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjIiIHN0eWxlPSJmaWxsOiM3Nzc7ZmlsbC1vcGFjaXR5OjAuNTsiLz48L2c+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSw0LDApIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMiIgaGVpZ2h0PSIyIiBzdHlsZT0iZmlsbDojNzc3O2ZpbGwtb3BhY2l0eTowLjU7Ii8+PC9nPjxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsOCwwKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgc3R5bGU9ImZpbGw6Izc3NztmaWxsLW9wYWNpdHk6MC41OyIvPjwvZz48ZyB0cmFuc2Zvcm09Im1hdHJpeCgxLDAsMCwxLDEyLDApIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMiIgaGVpZ2h0PSIyIiBzdHlsZT0iZmlsbDojNzc3O2ZpbGwtb3BhY2l0eTowLjU7Ii8+PC9nPjxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMTYsMCkiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjIiIHN0eWxlPSJmaWxsOiM3Nzc7ZmlsbC1vcGFjaXR5OjAuNTsiLz48L2c+PGcgdHJhbnNmb3JtPSJtYXRyaXgoMSwwLDAsMSwyMCwwKSI+PHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjIiIGhlaWdodD0iMiIgc3R5bGU9ImZpbGw6Izc3NztmaWxsLW9wYWNpdHk6MC41OyIvPjwvZz48ZyB0cmFuc2Zvcm09Im1hdHJpeCgxLDAsMCwxLDI0LDApIj48cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMiIgaGVpZ2h0PSIyIiBzdHlsZT0iZmlsbDojNzc3O2ZpbGwtb3BhY2l0eTowLjU7Ii8+PC9nPjxnIHRyYW5zZm9ybT0ibWF0cml4KDEsMCwwLDEsMjgsMCkiPjxyZWN0IHg9IjAiIHk9IjAiIHdpZHRoPSIyIiBoZWlnaHQ9IjIiIHN0eWxlPSJmaWxsOiM3Nzc7ZmlsbC1vcGFjaXR5OjAuNTsiLz48L2c+PC9nPjwvZz48L3N2Zz4=); + cursor: ns-resize; +`; + interface WorkspaceHeaderButtonProps { icon: React.ComponentType>; onClick: () => void; tooltipContent: string; } -function WorkspaceHeaderButton({ icon, onClick, tooltipContent }: WorkspaceHeaderButtonProps) { +function WorkspaceHeaderButton({ + icon, + onClick, + tooltipContent, +}: Readonly) { return ( x.key !== props.open.component); return ( - + ); } + +const WorkspaceNavStyled = styled.nav` + position: fixed; + z-index: 451; + bottom: 0; + right: 0; + height: 1.75rem; +`; diff --git a/server/sonar-web/src/main/js/components/workspace/WorkspaceNavItem.tsx b/server/sonar-web/src/main/js/components/workspace/WorkspaceNavItem.tsx index d687959befc..6448a4b30a5 100644 --- a/server/sonar-web/src/main/js/components/workspace/WorkspaceNavItem.tsx +++ b/server/sonar-web/src/main/js/components/workspace/WorkspaceNavItem.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import styled from '@emotion/styled'; -import { CloseIcon, InteractiveIcon } from 'design-system'; +import { CloseIcon, InteractiveIcon, themeColor } from 'design-system'; import * as React from 'react'; import { translate } from '../../helpers/l10n'; @@ -29,7 +29,7 @@ export interface Props { } export default class WorkspaceNavItem extends React.PureComponent { - handleNameClick = (event: React.MouseEvent) => { + handleNameClick = (event: React.MouseEvent) => { event.preventDefault(); event.currentTarget.blur(); this.props.onOpen(); @@ -37,16 +37,19 @@ export default class WorkspaceNavItem extends React.PureComponent { render() { return ( - - + + {this.props.children} - + @@ -55,5 +58,23 @@ export default class WorkspaceNavItem extends React.PureComponent { } const StyledWorkspaceNavItem = styled.li` - color: white; + display: inline-flex; + align-items: center; + position: relative; + color: ${themeColor('workSpaceNavItem')}; +`; + +const StyledWorkSpaceNavItemButton = styled.button` + display: inline-flex; + align-items: center; + border: none; + height: 1.75rem; + background-color: ${themeColor('workSpaceNavItemBackground')}; + color: ${themeColor('workSpaceNavItem')}; + + &:hover, + &:focus { + color: ${themeColor('workSpaceNavItem')}; + opacity: 0.9; + } `; diff --git a/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx b/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx index 11334f948d0..12e7f9eadbe 100644 --- a/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx +++ b/server/sonar-web/src/main/js/components/workspace/__tests__/Workspace-test.tsx @@ -136,12 +136,12 @@ it('should be resizable', async () => { expect(ui.workspaceViewerContainer.query()).not.toBeInTheDocument(); - const fileLink = byRole('link', { name: 'qualifier.FIL path/to/component/k1' }); - expect(fileLink.get()).toBeInTheDocument(); - await user.click(fileLink.get()); + const fileButton = byRole('button', { name: 'qualifier.FIL path/to/component/k1' }); + expect(fileButton.get()).toBeInTheDocument(); + await user.click(fileButton.get()); await user.click(ui.closeButton.get()); - expect(fileLink.query()).not.toBeInTheDocument(); + expect(fileButton.query()).not.toBeInTheDocument(); }); function renderWorkspace(componentKey = 'k1', branchLike?: BranchLike) { diff --git a/server/sonar-web/src/main/js/components/workspace/styles.css b/server/sonar-web/src/main/js/components/workspace/styles.css index 605293dc8d1..5b8a02ddf83 100644 --- a/server/sonar-web/src/main/js/components/workspace/styles.css +++ b/server/sonar-web/src/main/js/components/workspace/styles.css @@ -17,48 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -.workspace-nav { - position: fixed; - z-index: 451; - bottom: 0; - right: 0; - height: 28px; -} - -.workspace-nav-list { - float: right; -} - -.workspace-nav-item { - position: relative; - display: inline-flex; - align-items: center; - margin-right: var(--gridSize); -} - -.workspace-nav-item-link { - display: inline-flex; - align-items: center; - height: 28px; - padding: 0 calc(3.5 * var(--gridSize)) 0 var(--gridSize); - border: none; - background-color: var(--gray40); - color: #fff; - font-size: var(--smallFontSize); -} - -.workspace-nav-item-link:hover, -.workspace-nav-item-link:focus { - color: #fff; - opacity: 0.9; -} - -.workspace-nav-item-close { - position: absolute; - right: 4px; - top: 4px; -} - .workspace-viewer { position: fixed; z-index: 450; @@ -70,27 +28,6 @@ box-shadow: 0 -6px 12px rgba(0, 0, 0, 0.175); } -.workspace-viewer-header { - position: relative; - height: 30px; - padding: 3px 10px; - box-sizing: border-box; - background-color: var(--gray40); - color: #fff; - font-weight: 300; -} - -.workspace-viewer-name { - float: left; - line-height: var(--controlHeight); - color: #fff; - font-weight: 400; -} - -.workspace-viewer-name i { - margin-top: 3px; -} - .workspace-viewer-resize { position: absolute; top: 3px; @@ -102,19 +39,6 @@ cursor: ns-resize; } -.workspace-viewer-actions { - float: right; -} - -.workspace-viewer-actions a { - color: inherit; -} - -.workspace-header-icon:hover path, -.workspace-header-icon:focus path { - color: var(--gray40); -} - .workspace-viewer-container { height: calc(40vh - 30px); min-height: 100px; -- 2.39.5