From abcb9a091d999569ed6f5bbe86a8ba24c11994cc Mon Sep 17 00:00:00 2001 From: Philippe Perrin Date: Tue, 12 Jul 2022 11:09:07 +0200 Subject: [PATCH] [NO-JIRA] Consistently use ButtonToggle component --- .../components/PortfolioNewCodeToggle.tsx | 53 --------------- .../main/js/apps/code/components/Search.tsx | 23 +++++-- .../__tests__/PortfolioNewCodeToggle-test.tsx | 64 ------------------- .../PortfolioNewCodeToggle-test.tsx.snap | 26 -------- .../__snapshots__/Search-test.tsx.snap | 48 +++++++++++--- .../js/apps/issues/components/IssuesApp.tsx | 17 +++-- .../apps/issues/components/MyIssuesFilter.tsx | 54 ---------------- .../__snapshots__/IssuesApp-test.tsx.snap | 26 ++++++-- .../src/main/js/apps/issues/styles.css | 5 -- .../projects/components/FavoriteFilter.tsx | 59 +++++++++-------- .../apps/projects/components/PageSidebar.tsx | 7 +- .../__tests__/FavoriteFilter-test.tsx | 40 ++++++++---- .../__snapshots__/PageSidebar-test.tsx.snap | 20 ++---- .../main/js/components/controls/buttons.css | 55 +--------------- 14 files changed, 155 insertions(+), 342 deletions(-) delete mode 100644 server/sonar-web/src/main/js/apps/code/components/PortfolioNewCodeToggle.tsx delete mode 100644 server/sonar-web/src/main/js/apps/code/components/__tests__/PortfolioNewCodeToggle-test.tsx delete mode 100644 server/sonar-web/src/main/js/apps/code/components/__tests__/__snapshots__/PortfolioNewCodeToggle-test.tsx.snap delete mode 100644 server/sonar-web/src/main/js/apps/issues/components/MyIssuesFilter.tsx diff --git a/server/sonar-web/src/main/js/apps/code/components/PortfolioNewCodeToggle.tsx b/server/sonar-web/src/main/js/apps/code/components/PortfolioNewCodeToggle.tsx deleted file mode 100644 index 417f58d0c4f..00000000000 --- a/server/sonar-web/src/main/js/apps/code/components/PortfolioNewCodeToggle.tsx +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2022 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 { Button } from '../../../components/controls/buttons'; -import Tooltip from '../../../components/controls/Tooltip'; -import { translate } from '../../../helpers/l10n'; - -export interface PortfolioNewCodeToggleProps { - enabled: boolean; - showNewCode: boolean; - onNewCodeToggle: (newSelected: boolean) => void; -} - -export default function PortfolioNewCodeToggle(props: PortfolioNewCodeToggleProps) { - const { showNewCode, enabled } = props; - return ( - -
- - -
-
- ); -} diff --git a/server/sonar-web/src/main/js/apps/code/components/Search.tsx b/server/sonar-web/src/main/js/apps/code/components/Search.tsx index d4b5c14b8e5..8fee9b154cc 100644 --- a/server/sonar-web/src/main/js/apps/code/components/Search.tsx +++ b/server/sonar-web/src/main/js/apps/code/components/Search.tsx @@ -20,6 +20,7 @@ import { isEmpty, omit } from 'lodash'; import * as React from 'react'; import { getTree } from '../../../api/components'; +import ButtonToggle from '../../../components/controls/ButtonToggle'; import SearchBox from '../../../components/controls/SearchBox'; import { Location, Router, withRouter } from '../../../components/hoc/withRouter'; import DeferredSpinner from '../../../components/ui/DeferredSpinner'; @@ -28,7 +29,6 @@ import { KeyboardKeys } from '../../../helpers/keycodes'; import { translate } from '../../../helpers/l10n'; import { BranchLike } from '../../../types/branch-like'; import { ComponentMeasure } from '../../../types/types'; -import PortfolioNewCodeToggle from './PortfolioNewCodeToggle'; interface Props { branchLike?: BranchLike; @@ -140,10 +140,23 @@ export class Search extends React.PureComponent { return (