Skip to content

Commit

Permalink
refactor: rename Title to CanaryCheckName for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
mainawycliffe committed Oct 25, 2024
1 parent 31c2216 commit 5bef6c4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/components/Canary/CanaryCards.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { GetName } from "./data";
import { Title, StatusList } from "./renderers";
import { HealthCheck } from "../../api/types/health";
import { GetName } from "./data";
import { CanaryCheckName, StatusList } from "./renderers";

type CanaryCardProps = {
checks: HealthCheck[];
Expand All @@ -23,7 +22,10 @@ export function CanaryCards({ checks, onClick }: CanaryCardProps) {
>
<div className="flex-1 py-2 text-sm">
<span className="truncate font-medium text-gray-900 hover:text-gray-600">
<Title title={GetName(check)} icon={check.icon || check.type} />
<CanaryCheckName
title={GetName(check)}
icon={check.icon || check.type}
/>
</span>
<div className="float-right mr-2">
<StatusList check={check} />
Expand Down
10 changes: 8 additions & 2 deletions src/components/Canary/Columns/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import dayjs from "dayjs";
import { Status } from "../../Status";
import { GetName } from "../data";
import style from "../index.module.css";
import { Duration, Percentage, StatusList, Title, empty } from "../renderers";
import {
CanaryCheckName,
Duration,
empty,
Percentage,
StatusList
} from "../renderers";
import { removeNamespacePrefix } from "../utils";
import {
getHealthPercentageScore,
Expand Down Expand Up @@ -131,7 +137,7 @@ export function TitleCell({
// paddingLeft: `${row.depth * 1.1}rem`
// }}
>
<Title
<CanaryCheckName
title={title}
icon={rowValues.icon || rowValues.type}
isDeleted={!!row.original.deleted_at}
Expand Down
8 changes: 6 additions & 2 deletions src/components/Canary/renderers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,17 @@ export function Percentage({ val, upper, lower }: PercentageProps) {
);
}

type TitleProps = {
type CanaryCheckNameProps = {
icon?: string;
title: string;
isDeleted?: boolean;
};

export function Title({ icon, title, isDeleted }: TitleProps) {
export function CanaryCheckName({
icon,
title,
isDeleted
}: CanaryCheckNameProps) {
return (
<>
{icon && <Icon name={icon} className="h-6 w-auto" />}
Expand Down

0 comments on commit 5bef6c4

Please sign in to comment.