diff --git a/src/components/AccordionBox/index.js b/src/components/AccordionBox/index.js index 12e4724ef..09174f45c 100644 --- a/src/components/AccordionBox/index.js +++ b/src/components/AccordionBox/index.js @@ -18,18 +18,20 @@ export function AccordionBox({ content, hiddenContent, ...rest }) { > {hiddenContent} -
- -
+ {hiddenContent && ( +
+ +
+ )} ); } diff --git a/src/components/Canary/CanaryPopup/index.js b/src/components/Canary/CanaryPopup/index.js index 07aa0e1b6..29fb939f5 100644 --- a/src/components/Canary/CanaryPopup/index.js +++ b/src/components/Canary/CanaryPopup/index.js @@ -1,4 +1,4 @@ -import React from "react"; +import React, { useState } from "react"; import { format } from "timeago.js"; import { usePrevious } from "../../../utils/hooks"; import { Badge } from "../../Badge"; @@ -12,6 +12,7 @@ import { capitalizeFirstLetter, toFixedIfNecessary } from "../../../utils/common"; +import styles from "../index.module.css"; export function CheckTitle({ check, className, ...rest }) { const prevCheck = usePrevious(check); @@ -86,10 +87,7 @@ export function CheckDetails({ check, ...rest }) { })} ), - Owner: validCheck?.owner || "-" - }; - - const hiddenDetails = { + Owner: validCheck?.owner || "-", Interval: validCheck?.interval || "-", Location: validCheck?.location || "-", Schedule: validCheck?.schedule || "-" @@ -133,52 +131,51 @@ export function CheckDetails({ check, ...rest }) { /> {/* chart section */} -
+
Health overview (time dropdown)
- {/* check details section */} -
-
- Check details -
- - {Object.entries(details).map(([label, value]) => ( - - ))} -
- } - hiddenContent={ -
- {Object.entries(hiddenDetails).map(([label, value]) => ( - + +
+ ) + }, + checkDetails: { + label: "Check details", + content: ( +
+ + {Object.entries(details).map(([label, value]) => ( + + ))} +
+ } /> - ))} -
+
+ ) } - /> - - {/* status history section */} -
-
- Status history -
- -
+ }} + /> ); } @@ -219,7 +216,7 @@ function DetailField({ label, value, className, ...rest }) { ); } -function StatusHistory({ check }) { +function StatusHistory({ check, sticky = "false" }) { const statii = check ? check.checkStatuses != null ? check.checkStatuses @@ -252,7 +249,37 @@ function StatusHistory({ check }) { id={`${check.key}-table`} data={data} columns={["Age", "Duration", "Message"]} + sticky={sticky} /> ) ); } + +export function PopupTabs({ tabs, contentStyle, ...rest }) { + const [selected, setSelected] = useState(Object.keys(tabs)[0]); + return ( +
+
+ {Object.entries(tabs).map(([key, tab]) => ( + + ))} +
+
+ {Object.entries(tabs).map( + ([key, tab]) => selected === key &&
{tab.content}
+ )} +
+
+ ); +} diff --git a/src/components/Canary/index.js b/src/components/Canary/index.js index baeddce76..51f82a30a 100644 --- a/src/components/Canary/index.js +++ b/src/components/Canary/index.js @@ -28,6 +28,8 @@ import { getLocalItem, setLocalItem } from "../../utils/storage"; import { Modal } from "../Modal"; import { CheckDetails, CheckTitle } from "./CanaryPopup"; +import styles from "./index.module.css"; + export class Canary extends React.Component { constructor(props) { super(props); @@ -382,13 +384,23 @@ export class Canary extends React.Component { } - body={} - cardClass="px-8 py-6 my-12" - cardStyle={{ width: "100%", maxWidth: "730px" }} + onClose={this.handleModalClose} + title={} + body={ + + } + containerClass="py-4 h-full" + cardClass="w-full h-full flex flex-col" + cardStyle={{ + maxWidth: "820px", + maxHeight: "900px" + }} + contentClass="flex flex-col h-full p-8" + closeButtonPadding={8} /> ); diff --git a/src/components/Canary/index.module.css b/src/components/Canary/index.module.css index 56caeadab..324ed9ba5 100644 --- a/src/components/Canary/index.module.css +++ b/src/components/Canary/index.module.css @@ -8,3 +8,27 @@ background: linear-gradient(90deg, transparent calc(100% - 26px), white); pointer-events: none; } + +/* width */ +.appleScrollbar::-webkit-scrollbar { + -webkit-appearance: none; + width: 7px; +} + +/* Track */ +.appleScrollbar::-webkit-scrollbar-track { + background: #f1f1f1; + border-radius: 4px; +} + +/* Handle */ +.appleScrollbar::-webkit-scrollbar-thumb { + border-radius: 4px; + background: rgb(160, 160, 160); + box-shadow: 0 0 1px rgba(255, 255, 255, 0.5); +} + +/* Handle on hover */ +.appleScrollbar::-webkit-scrollbar-thumb:hover { + background-color: rgba(0, 0, 0, 0.5); +} diff --git a/src/components/Canary/table.js b/src/components/Canary/table.js index 3a57137d7..da3b825b2 100644 --- a/src/components/Canary/table.js +++ b/src/components/Canary/table.js @@ -12,7 +12,7 @@ import { useCheckSetEqualityForPreviousVsCurrent } from "../Hooks/useCheckSetEqu const styles = { outerDivClass: "border-l border-r border-gray-300", topBgClass: "bg-red-500", - tableClass: "min-w-full border-separate", + tableClass: "min-w-full border-separate", theadClass: "bg-white z-10", theadRowClass: "z-10", theadHeaderClass: diff --git a/src/components/Modal/index.js b/src/components/Modal/index.js index a007363e2..7b7b35873 100644 --- a/src/components/Modal/index.js +++ b/src/components/Modal/index.js @@ -10,6 +10,7 @@ export function Modal({ onClose, closeButtonPadding, containerClass, + contentClass, cardClass = "p-4", cancelText = "Close", hideActions, @@ -21,12 +22,14 @@ export function Modal({
+ {/* top-right close button */}
@@ -65,21 +71,21 @@ export function Modal({
-
+
{title && title} {body} + {!hideActions && ( +
+ +
+ )}
- {!hideActions && ( -
- -
- )}
diff --git a/src/components/Table/index.js b/src/components/Table/index.js index ef557bc1a..7dae6d525 100644 --- a/src/components/Table/index.js +++ b/src/components/Table/index.js @@ -1,4 +1,4 @@ -export function Table({ columns, data, id }) { +export function Table({ columns, data, id, sticky = "false" }) { columns = columns.map((c) => { if (typeof c === "string") { return { name: c }; @@ -7,40 +7,39 @@ export function Table({ columns, data, id }) { }); return (
-
-
-
- - - - {columns.map((column) => ( - - ))} - - - - {data.map((row, idx) => ( - // eslint-disable-next-line react/no-array-index-key - - {columns.map((column) => ( - - ))} - +
+
- {column.name} -
-
- {row[column.name.toLowerCase()]} -
-
+ + + {columns.map((column) => ( + + ))} + + + + {data.map((row, idx) => ( + // eslint-disable-next-line react/no-array-index-key + + {columns.map((column) => ( + ))} - -
+ {column.name} +
+
+ {row[column.name.toLowerCase()]} +
+
-
-
+ + ))} + +
); diff --git a/tailwind.config.js b/tailwind.config.js index 6e7d8e40d..3805187a0 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,5 +1,6 @@ // eslint-disable-next-line global-require const colors = require("tailwindcss/colors"); +const { borderWidth } = require("tailwindcss/defaultTheme"); module.exports = { purge: ["./src/**/*.{js,jsx,ts,tsx}", "./public/index.html"], @@ -53,7 +54,8 @@ module.exports = { variants: { extend: { backgroundColor: ["disabled"], - textColor: ["disabled"] + textColor: ["disabled"], + borderWidth: ["last"] } }, // eslint-disable-next-line global-require plugins: [require("@tailwindcss/forms"), require("@tailwindcss/typography")]