Skip to content

Commit 452329b

Browse files
committed
Extract RawResultRow to separate file
1 parent 1afee02 commit 452329b

File tree

2 files changed

+41
-36
lines changed

2 files changed

+41
-36
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import * as React from "react";
2+
import { styled } from "styled-components";
3+
4+
import { CellValue } from "../../common/bqrs-cli-types";
5+
import { RawResultCell } from "./RawResultCell";
6+
7+
const StyledRow = styled.div`
8+
border-color: var(--vscode-editor-snippetFinalTabstopHighlightBorder);
9+
border-style: solid;
10+
justify-content: center;
11+
align-items: center;
12+
padding: 0.4rem;
13+
word-break: break-word;
14+
`;
15+
16+
type RowProps = {
17+
row: CellValue[];
18+
fileLinkPrefix: string;
19+
sourceLocationPrefix: string;
20+
};
21+
22+
export const RawResultRow = ({
23+
row,
24+
fileLinkPrefix,
25+
sourceLocationPrefix,
26+
}: RowProps) => (
27+
<>
28+
{row.map((cell, cellIndex) => (
29+
<StyledRow key={cellIndex}>
30+
<RawResultCell
31+
value={cell}
32+
fileLinkPrefix={fileLinkPrefix}
33+
sourceLocationPrefix={sourceLocationPrefix}
34+
/>
35+
</StyledRow>
36+
))}
37+
</>
38+
);

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

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,13 @@
11
import * as React from "react";
22
import { useState } from "react";
33
import { styled } from "styled-components";
4-
import {
5-
CellValue,
6-
RawResultSet,
7-
ResultSetSchema,
8-
} from "../../common/bqrs-cli-types";
4+
import { RawResultSet, ResultSetSchema } from "../../common/bqrs-cli-types";
95
import TextButton from "../common/TextButton";
106
import { useTelemetryOnChange } from "../common/telemetry";
11-
import { RawResultCell } from "./RawResultCell";
7+
import { RawResultRow } from "./RawResultRow";
128

139
const numOfResultsInContractedMode = 5;
1410

15-
const StyledRow = styled.div`
16-
border-color: var(--vscode-editor-snippetFinalTabstopHighlightBorder);
17-
border-style: solid;
18-
justify-content: center;
19-
align-items: center;
20-
padding: 0.4rem;
21-
word-break: break-word;
22-
`;
23-
2411
type TableContainerProps = {
2512
columnCount: number;
2613
};
@@ -38,26 +25,6 @@ const TableContainer = styled.div<TableContainerProps>`
3825
padding: 0.4rem;
3926
`;
4027

41-
type RowProps = {
42-
row: CellValue[];
43-
fileLinkPrefix: string;
44-
sourceLocationPrefix: string;
45-
};
46-
47-
const Row = ({ row, fileLinkPrefix, sourceLocationPrefix }: RowProps) => (
48-
<>
49-
{row.map((cell, cellIndex) => (
50-
<StyledRow key={cellIndex}>
51-
<RawResultCell
52-
value={cell}
53-
fileLinkPrefix={fileLinkPrefix}
54-
sourceLocationPrefix={sourceLocationPrefix}
55-
/>
56-
</StyledRow>
57-
))}
58-
</>
59-
);
60-
6128
type RawResultsTableProps = {
6229
schema: ResultSetSchema;
6330
results: RawResultSet;
@@ -86,7 +53,7 @@ const RawResultsTable = ({
8653
<>
8754
<TableContainer columnCount={schema.columns.length}>
8855
{results.rows.slice(0, numOfResultsToShow).map((row, rowIndex) => (
89-
<Row
56+
<RawResultRow
9057
key={rowIndex}
9158
row={row}
9259
fileLinkPrefix={fileLinkPrefix}

0 commit comments

Comments
 (0)