From fa96a47bdf31344bfcb3f8498b0f66e6627ccfff Mon Sep 17 00:00:00 2001 From: Vojtech Mares Date: Mon, 22 Aug 2022 09:43:01 +0200 Subject: [PATCH] refactor(infra.mareshq.com): put tables into component and add horizontal overflow --- sites/infra.mareshq.com/pages/index.tsx | 126 +++++++++++------------- themes/infra/components/Table.tsx | 23 +++++ 2 files changed, 82 insertions(+), 67 deletions(-) create mode 100644 themes/infra/components/Table.tsx diff --git a/sites/infra.mareshq.com/pages/index.tsx b/sites/infra.mareshq.com/pages/index.tsx index 96bef08..af87b9d 100644 --- a/sites/infra.mareshq.com/pages/index.tsx +++ b/sites/infra.mareshq.com/pages/index.tsx @@ -2,6 +2,7 @@ import type { NextPage } from 'next'; import Head from 'next/head'; import Layout from '@themes/infra/components/Layout'; import Link from '@themes/signpost/components/Link'; +import Table from '@themes/infra/components/Table'; import links from '../content/links.json'; import dedicatedServers from '../content/dedicated-servers.json'; import virtualServers from '../content/virtual-servers.json'; @@ -27,11 +28,11 @@ const Home: NextPage = () => {

MaresHQ Infrastructure

-
+

links

-
    +
      {links.map((l) => (
    • @@ -40,118 +41,109 @@ const Home: NextPage = () => {
-
+

virtual servers

- - - - - - - - - - +
nameproviderzoneipbelongs to
{virtualServers.map((vs) => ( - - - - + + + - + ))} -
{vs.name}{vs.provider}{vs.zone} + {vs.name}{vs.provider}{vs.zone} {vs.ip} {vs.belongsTo}{vs.belongsTo}
+

dedicated servers

- - - - - - - - - - +
nameproviderzoneipbelongs to
{dedicatedServers.map((ds) => ( - - - - + + + - + ))} -
{ds.name}{ds.provider}{ds.zone} + {ds.name}{ds.provider}{ds.zone} {ds.ip} {ds.belongsTo}{ds.belongsTo}
+

load balancers

- - - - - - - - - - +
nameproviderzoneipbelongs to
{loadbalancers.map((lb) => ( - - - - + + + - + ))} -
{lb.name}{lb.provider}{lb.zone} + {lb.name}{lb.provider}{lb.zone} {lb.ip} {lb.belongsTo}{lb.belongsTo}
+

kubernetes clusters

- - - - - - - - - - +
nameproviderzoneurl
{kubernetes.map((k8s) => ( - - - - - + + + + ))} -
{k8s.name}{k8s.provider}{k8s.zone}{k8s.url}{k8s.name}{k8s.provider}{k8s.zone} + {k8s.url} +
+
diff --git a/themes/infra/components/Table.tsx b/themes/infra/components/Table.tsx new file mode 100644 index 0000000..93e873f --- /dev/null +++ b/themes/infra/components/Table.tsx @@ -0,0 +1,23 @@ +import { ReactNode, FunctionComponent } from 'react'; + +type Props = { + columnNames: string[]; + children?: ReactNode; +}; + +const Table = ({ columnNames, children }: Props) => ( +
+ + + + {columnNames.map((cn) => ( + + ))} + + + {children} +
{cn}
+
+); + +export default Table;