From d41ab5c049a2634df40294d019cb689880ab20a2 Mon Sep 17 00:00:00 2001 From: stanislavh Date: Wed, 9 Aug 2023 13:08:09 +0200 Subject: [PATCH] SONAR-20023 Drop old type icon from source viewer --- .../components/__tests__/LineFinding-test.tsx | 7 +- .../__snapshots__/LineFinding-test.tsx.snap | 97 ------------------- .../src/components/code-line/LineFinding.tsx | 5 +- .../src/components/icons/IssueTypeIcon.tsx | 21 ---- .../ComponentSourceSnippetGroupViewer.tsx | 2 - 5 files changed, 2 insertions(+), 130 deletions(-) diff --git a/server/sonar-web/design-system/src/components/__tests__/LineFinding-test.tsx b/server/sonar-web/design-system/src/components/__tests__/LineFinding-test.tsx index 30d470d809b..2d05bd33cd6 100644 --- a/server/sonar-web/design-system/src/components/__tests__/LineFinding-test.tsx +++ b/server/sonar-web/design-system/src/components/__tests__/LineFinding-test.tsx @@ -30,16 +30,11 @@ it('should render correctly', async () => { expect(container).toMatchSnapshot(); }); -it('should render correctly when issueType is provided', () => { - const { container } = setupWithProps({ issueType: 'bugs' }); - expect(container).toMatchSnapshot(); -}); - it('should be clickable when onIssueSelect is provided', async () => { const mockClick = jest.fn(); const user = userEvent.setup(); - setupWithProps({ issueType: 'bugs', onIssueSelect: mockClick }); + setupWithProps({ onIssueSelect: mockClick }); await user.click(screen.getByRole('button')); expect(mockClick).toHaveBeenCalled(); }); diff --git a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineFinding-test.tsx.snap b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineFinding-test.tsx.snap index f68f4f6dec9..1d6ffe7a20d 100644 --- a/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineFinding-test.tsx.snap +++ b/server/sonar-web/design-system/src/components/__tests__/__snapshots__/LineFinding-test.tsx.snap @@ -49,100 +49,3 @@ exports[`should render correctly 1`] = ` `; - -exports[`should render correctly when issueType is provided 1`] = ` -.emotion-0 { - all: unset; - cursor: pointer; - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - gap: 0.5rem; - margin-left: 0.25rem; - margin-right: 0.25rem; - margin-top: 0.75rem; - margin-bottom: 0.75rem; - padding: 0.75rem; - font-family: Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"; - font-size: 1rem; - line-height: 1.5rem; - font-weight: 600; - border-radius: 0.25rem; - width: 100%; - box-sizing: border-box; - border: 1px solid rgb(253,162,155); - color: rgb(62,67,87); - font-weight: 600; - word-break: break-word; - background-color: rgb(255,255,255); -} - -.emotion-0:focus-visible { - background-color: rgb(239,242,249); -} - -.emotion-0:hover { - box-shadow: 0px 1px 3px 0px rgba(29,33,47,0.05),0px 1px 25px 0px rgba(29,33,47,0.05); -} - -.emotion-2 { - height: 1.5rem; - width: 1.5rem; - display: -webkit-inline-box; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - -webkit-flex-shrink: 0; - -ms-flex-negative: 0; - flex-shrink: 0; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - -webkit-box-pack: center; - -ms-flex-pack: center; - -webkit-justify-content: center; - justify-content: center; - background: rgb(254,205,202); - border-radius: 100%; -} - -
- -
-`; diff --git a/server/sonar-web/design-system/src/components/code-line/LineFinding.tsx b/server/sonar-web/design-system/src/components/code-line/LineFinding.tsx index 65bb88cc93d..742c478b197 100644 --- a/server/sonar-web/design-system/src/components/code-line/LineFinding.tsx +++ b/server/sonar-web/design-system/src/components/code-line/LineFinding.tsx @@ -22,19 +22,17 @@ import { forwardRef, Ref } from 'react'; import tw from 'twin.macro'; import { themeBorder, themeColor, themeContrast, themeShadow } from '../../helpers/theme'; import { BareButton } from '../buttons'; -import { IssueTypeCircleIcon } from '../icons/IssueTypeIcon'; interface Props { className?: string; issueKey: string; - issueType?: string; message: React.ReactNode; onIssueSelect?: (issueKey: string) => void; selected?: boolean; } function LineFindingFunc( - { issueType, message, issueKey, selected = true, className, onIssueSelect }: Props, + { message, issueKey, selected = true, className, onIssueSelect }: Props, ref: Ref ) { return ( @@ -49,7 +47,6 @@ function LineFindingFunc( ref={ref} selected={selected} > - {issueType && } {message} ); diff --git a/server/sonar-web/design-system/src/components/icons/IssueTypeIcon.tsx b/server/sonar-web/design-system/src/components/icons/IssueTypeIcon.tsx index 94047ec41c7..7988daa5c6a 100644 --- a/server/sonar-web/design-system/src/components/icons/IssueTypeIcon.tsx +++ b/server/sonar-web/design-system/src/components/icons/IssueTypeIcon.tsx @@ -18,10 +18,6 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { useTheme } from '@emotion/react'; -import styled from '@emotion/styled'; -import tw from 'twin.macro'; -import { themeColor, themeContrast } from '../../helpers/theme'; import { IssueType } from '../../types'; import { BugIcon } from './BugIcon'; import { CodeSmellIcon } from './CodeSmellIcon'; @@ -67,20 +63,3 @@ export function IssueTypeIcon({ type, ...iconProps }: Props) { return null; } } - -export function IssueTypeCircleIcon({ className, type, ...iconProps }: Props) { - const theme = useTheme(); - return ( - - - - ); -} - -const CircleIconContainer = styled.div` - ${tw`sw-w-6 sw-h-6`} - ${tw`sw-inline-flex sw-items-center sw-justify-center sw-shrink-0`}; - - background: ${themeColor('issueTypeIcon')}; - border-radius: 100%; -`; diff --git a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx index 47d82f53de2..f2c5df4f80f 100644 --- a/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx +++ b/server/sonar-web/src/main/js/apps/issues/crossComponentSourceViewer/ComponentSourceSnippetGroupViewer.tsx @@ -240,7 +240,6 @@ export default class ComponentSourceSnippetGroupViewer extends React.PureCompone {(ctx) => ( {(ctx) => (