From d164e538cd35edb8e1753e49f6ea21096e8d5efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Leszczyk?= Date: Mon, 11 Apr 2022 13:32:22 +0200 Subject: [PATCH] fix(dashboard-v2): hide View All link when there's nothing to view --- .../LatestActivity/ActivityTable.js | 34 +++++++++++-------- .../LatestActivity/LatestActivity.js | 13 ------- .../components/LatestActivity/ViewAllLink.js | 12 +++++++ 3 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 packages/dashboard-v2/src/components/LatestActivity/ViewAllLink.js diff --git a/packages/dashboard-v2/src/components/LatestActivity/ActivityTable.js b/packages/dashboard-v2/src/components/LatestActivity/ActivityTable.js index 345a2daa..2ee95e0f 100644 --- a/packages/dashboard-v2/src/components/LatestActivity/ActivityTable.js +++ b/packages/dashboard-v2/src/components/LatestActivity/ActivityTable.js @@ -4,6 +4,7 @@ import useSWR from "swr"; import { Table, TableBody, TableCell, TableRow } from "../Table"; import { ContainerLoadingIndicator } from "../LoadingIndicator"; +import { ViewAllLink } from "./ViewAllLink"; import useFormattedActivityData from "./useFormattedActivityData"; export default function ActivityTable({ type }) { @@ -22,20 +23,23 @@ export default function ActivityTable({ type }) { } return ( - - - {items.map(({ id, name, type, size, date, skylink }) => ( - - {name} - {type} - - {size} - - {date} - {skylink} - - ))} - -
+ <> + + + {items.map(({ id, name, type, size, date, skylink }) => ( + + {name} + {type} + + {size} + + {date} + {skylink} + + ))} + +
+ + ); } diff --git a/packages/dashboard-v2/src/components/LatestActivity/LatestActivity.js b/packages/dashboard-v2/src/components/LatestActivity/LatestActivity.js index 87825661..535bceba 100644 --- a/packages/dashboard-v2/src/components/LatestActivity/LatestActivity.js +++ b/packages/dashboard-v2/src/components/LatestActivity/LatestActivity.js @@ -1,21 +1,10 @@ import * as React from "react"; -import { Link } from "gatsby"; import { Panel } from "../Panel"; import { Tab, TabPanel, Tabs } from "../Tabs"; -import { ArrowRightIcon } from "../Icons"; import ActivityTable from "./ActivityTable"; -const ViewAllLink = (props) => ( - - - - - View all - -); - export default function LatestActivity() { return ( @@ -24,11 +13,9 @@ export default function LatestActivity() { - - diff --git a/packages/dashboard-v2/src/components/LatestActivity/ViewAllLink.js b/packages/dashboard-v2/src/components/LatestActivity/ViewAllLink.js new file mode 100644 index 00000000..2cee28ea --- /dev/null +++ b/packages/dashboard-v2/src/components/LatestActivity/ViewAllLink.js @@ -0,0 +1,12 @@ +import { Link } from "gatsby"; + +import { ArrowRightIcon } from "../Icons"; + +export const ViewAllLink = (props) => ( + + + + + View all + +);