Skip to content

Commit

Permalink
fix: show two columns, when the other one is empty
Browse files Browse the repository at this point in the history
fix: show two columns when no none headline properties

chore: remove console.log

chore: update spacing

fix: show two property columns when no analytics

fix: fix issues with cards styling

fix: scroll issues

fix: refactor and re-sort components statuses

chore: remove console logs
  • Loading branch information
mainawycliffe committed Oct 17, 2024
1 parent 9376740 commit dd8f354
Show file tree
Hide file tree
Showing 11 changed files with 586 additions and 382 deletions.
59 changes: 0 additions & 59 deletions src/components/Canary/HealthChecksSummary.tsx

This file was deleted.

91 changes: 0 additions & 91 deletions src/components/Incidents/IncidentCardSummary/index.tsx

This file was deleted.

18 changes: 12 additions & 6 deletions src/components/StatusLine/StatusLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ export type StatusLineData = {

export type StatusLineProps = React.HTMLProps<HTMLDivElement> & StatusLineData;

const renderIcon = (icon: string | React.ReactNode) => {
interface RenderIconProps {
icon: string | React.ReactNode;
}

const RenderIcon: React.FC<RenderIconProps> = ({ icon }) => {
if (!icon) {
return null;
}
if (typeof icon === "object") {
return icon;
// eslint-disable-next-line react/jsx-no-useless-fragment
return <>{icon}</>;
} else if (typeof icon === "string") {
return <Icon name={icon} className="h-4 w-4" />;
return <Icon name={icon} className="h-4 w-4 min-w-max" />;
}
return null;
};

const StatusInfoEntry = ({
Expand All @@ -46,14 +52,14 @@ const StatusInfoEntry = ({
to={statusInfo.url}
target={target || ""}
>
{statusInfo.icon && renderIcon(statusInfo.icon)}
{statusInfo.icon && <RenderIcon icon={statusInfo.icon} />}
<Chip text={statusInfo.label} color={statusInfo.color} />
</Link>
);
} else {
return (
<span className="inline-flex cursor-pointer space-x-1">
{statusInfo.icon && renderIcon(statusInfo.icon)}
{statusInfo.icon && <RenderIcon icon={statusInfo.icon} />}
<Chip text={statusInfo.label} color={statusInfo.color} />
</span>
);
Expand All @@ -74,7 +80,7 @@ export function StatusLine({
className={clsx("flex flex-row items-center space-x-1", className)}
{...rest}
>
{icon && renderIcon(icon)}
{icon && <RenderIcon icon={icon} />}
{url && (
<Link
title={label}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Topology/TopologyCard/CardMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export const CardMetrics = ({
labelClasses = "text-gray-600 font-semibold text-xs mb-0.5",
metricsClasses = "font-bold text-xs leading-1.21rel flex flex-center justify-center"
}: IProps) => {
if (!items || items.length === 0) {
return null;
}

return (
<div className="flex flex-1 items-center justify-between divide-x rounded-b-8px">
{items.map((item) => (
Expand Down
1 change: 0 additions & 1 deletion src/components/Topology/TopologyCard/Property.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export function PropertyDisplay({
className = "",
...props
}: PropertyDisplayProps) {
console.log("property display", property);
const { name, icon, color } = property;
const label =
NodePodPropToLabelMap[name as keyof typeof NodePodPropToLabelMap] || name;
Expand Down
Loading

0 comments on commit dd8f354

Please sign in to comment.