Skip to content

Commit 3817133

Browse files
committed
Refactor CodePaths and FileCodeSnippet components
This refactors the CodePaths and FileCodeSnippet components to be more readable and in style with the rest of the "new" components. It does the following: - Remove uses of the `style` and `sx` props; replace it by using `styled-components` instead - Remove uses of Primer icons - Split out the components into multiple files - Change the colors of the severity to match VSCode colors (and make them themable) I haven't removed the use of the Primer `Overlay` component yet, since this component seems to do quite a lot and the VSCode WebView UI Toolkit doesn't have a replacement for it.
1 parent bcf70c6 commit 3817133

5 files changed

Lines changed: 364 additions & 220 deletions

File tree

extensions/ql-vscode/src/stories/remote-queries/CodePaths.stories.tsx renamed to extensions/ql-vscode/src/stories/common/CodePaths.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import React from 'react';
33
import { ComponentStory, ComponentMeta } from '@storybook/react';
44
import { ThemeProvider } from '@primer/react';
55

6-
import CodePaths from '../../view/remote-queries/CodePaths';
6+
import { CodePaths } from '../../view/remote-queries/CodePaths';
77
import type { CodeFlow } from '../../remote-queries/shared/analysis-result';
88

99
export default {
@@ -112,8 +112,8 @@ PowerShell.args = {
112112
message: {
113113
tokens: [
114114
{
115-
type: 'text',
116-
t: 'This zip file may have a dangerous path'
115+
t: 'text',
116+
text: 'This zip file may have a dangerous path'
117117
}
118118
]
119119
},

extensions/ql-vscode/src/stories/remote-queries/FileCodeSnippet.stories.tsx renamed to extensions/ql-vscode/src/stories/common/FileCodeSnippet.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22

33
import { ComponentStory, ComponentMeta } from '@storybook/react';
44

5-
import FileCodeSnippet from '../../view/remote-queries/FileCodeSnippet';
5+
import { FileCodeSnippet } from '../../view/remote-queries/FileCodeSnippet';
66

77
export default {
88
title: 'File Code Snippet',

extensions/ql-vscode/src/view/remote-queries/AnalysisAlertResult.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { AnalysisAlert } from '../../remote-queries/shared/analysis-result';
3-
import CodePaths from './CodePaths';
4-
import FileCodeSnippet from './FileCodeSnippet';
3+
import { CodePaths } from './CodePaths';
4+
import { FileCodeSnippet } from './FileCodeSnippet';
55

66
const AnalysisAlertResult = ({ alert }: { alert: AnalysisAlert }) => {
77
const showPathsLink = alert.codeFlows.length > 0;

0 commit comments

Comments
 (0)