From 623bb408e98569e2cca65858a126f6da2ceff665 Mon Sep 17 00:00:00 2001 From: vishal mishra Date: Wed, 26 Jun 2024 01:26:29 +0530 Subject: [PATCH] fix : Responsive compare page Signed-off-by: vishal mishra --- website/src/common/Macrobench.tsx | 56 +++++---- website/src/components/ui/table.tsx | 117 ++++++++++++++++++ website/src/pages/ComparePage/ComparePage.tsx | 8 +- .../src/pages/ComparePage/components/Hero.tsx | 6 +- 4 files changed, 153 insertions(+), 34 deletions(-) create mode 100644 website/src/components/ui/table.tsx diff --git a/website/src/common/Macrobench.tsx b/website/src/common/Macrobench.tsx index ec4d39beb..ace3a7f6c 100644 --- a/website/src/common/Macrobench.tsx +++ b/website/src/common/Macrobench.tsx @@ -19,11 +19,12 @@ import PropTypes from 'prop-types'; import { Link } from "react-router-dom"; import { formatByte, fixed, secondToMicrosecond } from "../utils/Utils"; import {twMerge} from "tailwind-merge"; +import { Table, TableBody, TableHead, TableHeader,TableRow, } from "../components/ui/table"; export default function Macrobench({ data, gitRef, commits }) { return (
-
+

{data.type}

Click @@ -33,45 +34,46 @@ export default function Macrobench({ data, gitRef, commits }) { > here - to see the query plans comparison for this benchmark. + to see the query plans comparison + + for this benchmark. + + + + for this benchmark.
- - - -
- + + + + +

{" "}

+
+ {gitRef.old || "Old"} - -
- - - - - - - + +

P

+

Delta

+

Significant

+ + + - -
+ + {gitRef.new || "New"} - -

P

-
-

Delta

-
-

Significant

-
+ +
); } diff --git a/website/src/components/ui/table.tsx b/website/src/components/ui/table.tsx new file mode 100644 index 000000000..6a9df9141 --- /dev/null +++ b/website/src/components/ui/table.tsx @@ -0,0 +1,117 @@ +import * as React from "react" + +import { cn } from "@/library/utils" + +const Table = React.forwardRef< + HTMLTableElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+ + +)) +Table.displayName = "Table" + +const TableHeader = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableHeader.displayName = "TableHeader" + +const TableBody = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableBody.displayName = "TableBody" + +const TableFooter = React.forwardRef< + HTMLTableSectionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + tr]:last:border-b-0", + className + )} + {...props} + /> +)) +TableFooter.displayName = "TableFooter" + +const TableRow = React.forwardRef< + HTMLTableRowElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableRow.displayName = "TableRow" + +const TableHead = React.forwardRef< + HTMLTableCellElement, + React.ThHTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +TableHead.displayName = "TableHead" + +const TableCell = React.forwardRef< + HTMLTableCellElement, + React.TdHTMLAttributes +>(({ className, ...props }, ref) => ( + +)) +TableCell.displayName = "TableCell" + +const TableCaption = React.forwardRef< + HTMLTableCaptionElement, + React.HTMLAttributes +>(({ className, ...props }, ref) => ( +
+)) +TableCaption.displayName = "TableCaption" + +export { + Table, + TableHeader, + TableBody, + TableFooter, + TableHead, + TableRow, + TableCell, + TableCaption, +} diff --git a/website/src/pages/ComparePage/ComparePage.tsx b/website/src/pages/ComparePage/ComparePage.tsx index 946fe33d6..7b70afea9 100644 --- a/website/src/pages/ComparePage/ComparePage.tsx +++ b/website/src/pages/ComparePage/ComparePage.tsx @@ -21,7 +21,7 @@ import useApiCall from "../../utils/Hook"; import Hero from "./components/Hero"; import Macrobench from "../../common/Macrobench"; import { CompareData } from '@/types' - + export default function Compare() { const urlParams = new URLSearchParams(window.location.search); @@ -63,12 +63,12 @@ export default function Compare() { )} {!isMacrobenchLoading && !macrobenchTextLoading && compareData && compareData.length > 0 && ( -
-

Macro Benchmarks

+
+

Macro Benchmarks

{compareData.map((macro, index) => { return ( -
+
+

Enter SHAs to compare commits

-
+