Skip to content

Commit 64f33a5

Browse files
authored
Merge pull request #1520 from github/koesie10/react-components-common
Move common React components to separate directory
2 parents 48a527a + faabe6d commit 64f33a5

File tree

9 files changed

+12
-20
lines changed

9 files changed

+12
-20
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import styled from 'styled-components';
22

3-
const HorizontalSpace = styled.div<{ size: 1 | 2 | 3 }>`
3+
export const HorizontalSpace = styled.div<{ size: 1 | 2 | 3 }>`
44
flex: 0 0 auto;
55
display: inline-block;
66
width: ${props => 0.2 * props.size}em;
77
`;
8-
9-
export default HorizontalSpace;
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import styled from 'styled-components';
22

3-
const SectionTitle = styled.h2`
3+
export const SectionTitle = styled.h2`
44
font-size: medium;
55
font-weight: 500;
66
padding: 0 0.5em 0 0;
77
margin: 0;
88
display: inline-block;
99
vertical-align: middle;
1010
`;
11-
12-
export default SectionTitle;
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import styled from 'styled-components';
22

3-
const VerticalSpace = styled.div<{ size: 1 | 2 | 3 }>`
3+
export const VerticalSpace = styled.div<{ size: 1 | 2 | 3 }>`
44
flex: 0 0 auto;
55
height: ${props => 0.5 * props.size}em;
66
`;
7-
8-
export default VerticalSpace;
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import styled from 'styled-components';
22

3-
const ViewTitle = styled.h1`
3+
export const ViewTitle = styled.h1`
44
font-size: 2em;
55
margin-bottom: 0.5em;
66
font-weight: 500;
@@ -9,5 +9,3 @@ const ViewTitle = styled.h1`
99
overflow: hidden;
1010
text-overflow: ellipsis;
1111
`;
12-
13-
export default ViewTitle;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from './HorizontalSpace';
2+
export * from './SectionTitle';
3+
export * from './VerticalSpace';
4+
export * from './ViewTitle';

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

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import * as React from 'react';
55
import { ChangeEvent, useRef, useState } from 'react';
66
import styled from 'styled-components';
77
import { CodeFlow, AnalysisMessage, ResultSeverity } from '../../remote-queries/shared/analysis-result';
8+
import { SectionTitle, VerticalSpace } from '../common';
89
import FileCodeSnippet from './FileCodeSnippet';
9-
import SectionTitle from './SectionTitle';
10-
import VerticalSpace from './VerticalSpace';
1110

1211
const StyledCloseButton = styled.button`
1312
position: absolute;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as React from 'react';
22
import styled from 'styled-components';
33
import { CodeSnippet, FileLink, HighlightedRegion, AnalysisMessage, ResultSeverity } from '../../remote-queries/shared/analysis-result';
4-
import VerticalSpace from './VerticalSpace';
54
import { createRemoteFileRef } from '../../pure/location-link-utils';
65
import { parseHighlightedLine, shouldHighlightLine } from '../../pure/sarif-utils';
76
import { VSCodeLink } from '@vscode/webview-ui-toolkit/react';
7+
import { VerticalSpace } from '../common';
88

99
const borderColor = 'var(--vscode-editor-snippetFinalTabstopHighlightBorder)';
1010
const warningColor = '#966C23';

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@ import { AnalysisSummary, RemoteQueryResult } from '../../remote-queries/shared/
66
import { MAX_RAW_RESULTS } from '../../remote-queries/shared/result-limits';
77
import { vscode } from '../vscode-api';
88
import { VSCodeBadge, VSCodeButton } from '@vscode/webview-ui-toolkit/react';
9-
import SectionTitle from './SectionTitle';
10-
import VerticalSpace from './VerticalSpace';
11-
import HorizontalSpace from './HorizontalSpace';
12-
import ViewTitle from './ViewTitle';
9+
import { HorizontalSpace, SectionTitle, VerticalSpace, ViewTitle } from '../common';
1310
import DownloadButton from './DownloadButton';
1411
import { AnalysisResults, getAnalysisResultCount } from '../../remote-queries/shared/analysis-result';
1512
import DownloadSpinner from './DownloadSpinner';

extensions/ql-vscode/src/view/variant-analysis/QueryDetails.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import styled from 'styled-components';
3-
import ViewTitle from '../remote-queries/ViewTitle';
3+
import { ViewTitle } from '../common';
44
import { LinkIconButton } from './LinkIconButton';
55

66
export type QueryDetailsProps = {

0 commit comments

Comments
 (0)