From 50ce122fca75f39cf96640e8b8f9ce4fd854bfcc Mon Sep 17 00:00:00 2001 From: alde Date: Mon, 19 Apr 2021 15:07:20 -0400 Subject: [PATCH] Stop using React.FC, use CardHeader instead of Box MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fredrik Adelöw --- .../CoverageHistoryChart.tsx | 108 ++++++++---------- .../components/FileExplorer/CoverageRow.tsx | 4 +- .../components/FileExplorer/FileContent.tsx | 4 +- .../components/FileExplorer/FileExplorer.tsx | 80 ++++++------- 4 files changed, 87 insertions(+), 109 deletions(-) diff --git a/plugins/code-coverage/src/components/CoverageHistoryChart/CoverageHistoryChart.tsx b/plugins/code-coverage/src/components/CoverageHistoryChart/CoverageHistoryChart.tsx index 4f4f442315..f9927a17d3 100644 --- a/plugins/code-coverage/src/components/CoverageHistoryChart/CoverageHistoryChart.tsx +++ b/plugins/code-coverage/src/components/CoverageHistoryChart/CoverageHistoryChart.tsx @@ -19,9 +19,8 @@ import { Box, Card, CardContent, + CardHeader, makeStyles, - MenuItem, - Select, Typography, } from '@material-ui/core'; import { @@ -97,16 +96,10 @@ export const CoverageHistoryChart = () => { if (!valueHistory.history.length) { return ( - - - - - History - - No coverage history found - - - + + + No coverage history found + ); } @@ -128,58 +121,47 @@ export const CoverageHistoryChart = () => { const branchTrend = getTrendForCoverage('branch'); return ( - - - - - History - + + + + + + {getTrendIcon(lineTrend, classes)} + + Current line: {latestCoverage.line.percentage}%
( + {Math.floor(lineTrend)}% change over {valueHistory.history.length}{' '} + builds) +
- - - {getTrendIcon(lineTrend, classes)} - - Current line: {latestCoverage.line.percentage}%
( - {Math.floor(lineTrend)}% change over{' '} - {valueHistory.history.length} builds) -
-
- - {getTrendIcon(branchTrend, classes)} - - Current branch: {latestCoverage.branch.percentage}%
( - {Math.floor(branchTrend)}% change over{' '} - {valueHistory.history.length} builds) -
-
+ + {getTrendIcon(branchTrend, classes)} + + Current branch: {latestCoverage.branch.percentage}%
( + {Math.floor(branchTrend)}% change over{' '} + {valueHistory.history.length} builds) +
- - - - - - - - - - - - -
-
-
+
+ + + + + + + + + + + + + + ); }; diff --git a/plugins/code-coverage/src/components/FileExplorer/CoverageRow.tsx b/plugins/code-coverage/src/components/FileExplorer/CoverageRow.tsx index b213ad05de..4af4fbbf4e 100644 --- a/plugins/code-coverage/src/components/FileExplorer/CoverageRow.tsx +++ b/plugins/code-coverage/src/components/FileExplorer/CoverageRow.tsx @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React, { FC } from 'react'; +import React from 'react'; // styles import { makeStyles } from '@material-ui/core'; @@ -65,7 +65,7 @@ type CodeRowProps = { lineContent: string; lineHits?: number | null; }; -const CodeRow: FC = ({ +const CodeRow = ({ lineNumber, lineContent, lineHits = null, diff --git a/plugins/code-coverage/src/components/FileExplorer/FileContent.tsx b/plugins/code-coverage/src/components/FileExplorer/FileContent.tsx index e4ade53f37..703489f587 100644 --- a/plugins/code-coverage/src/components/FileExplorer/FileContent.tsx +++ b/plugins/code-coverage/src/components/FileExplorer/FileContent.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ -import React, { FC } from 'react'; +import React from 'react'; import { useApi } from '@backstage/core-api'; import { useEntity } from '@backstage/plugin-catalog-react'; import { useAsync } from 'react-use'; @@ -53,7 +53,7 @@ type FormattedLinesProps = { highlightedLines: string[]; lineHits: Record; }; -const FormattedLines: FC = ({ +const FormattedLines = ({ highlightedLines, lineHits, }: FormattedLinesProps) => { diff --git a/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx b/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx index da20ba0ed6..704edcdf15 100644 --- a/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx +++ b/plugins/code-coverage/src/components/FileExplorer/FileExplorer.tsx @@ -26,9 +26,9 @@ import { Box, Card, CardContent, + CardHeader, Modal, Tooltip, - Typography, } from '@material-ui/core'; import React, { Fragment, useEffect, useState } from 'react'; import { useAsync } from 'react-use'; @@ -244,46 +244,42 @@ export const FileExplorer = () => { } return ( - - - - - Explore Files - - - {pathArray.map((pathElement, idx) => ( - -
moveUpIntoPath(pathElement)} - onClick={() => moveUpIntoPath(pathElement)} - > - {pathElement || 'root'} -
-
{'\u00A0/\u00A0'}
-
- ))} -
- No files found} - data={tableData || []} - columns={columns} - /> - event.stopPropagation()} - onClose={() => setModalOpen(false)} - style={{ overflow: 'scroll' }} - > - - - - - + + + + + {pathArray.map((pathElement, idx) => ( + +
moveUpIntoPath(pathElement)} + onClick={() => moveUpIntoPath(pathElement)} + > + {pathElement || 'root'} +
+
{'\u00A0/\u00A0'}
+
+ ))} +
+
No files found} + data={tableData || []} + columns={columns} + /> + event.stopPropagation()} + onClose={() => setModalOpen(false)} + style={{ overflow: 'scroll' }} + > + + + + ); };