Files
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00

47 lines
1.2 KiB
TypeScript

import * as React from "react";
import styled from "styled-components";
import type {
IssueTrackerIntegrationService,
UnfurlResourceType,
UnfurlResponse,
} from "../../types";
import { IntegrationService } from "../../types";
import { GitHubIssueStatusIcon } from "./GitHubIssueStatusIcon";
import { LinearIssueStatusIcon } from "./LinearIssueStatusIcon";
export type BaseIconProps = {
state: UnfurlResponse[UnfurlResourceType.Issue]["state"];
className?: string;
size?: number;
};
type Props = BaseIconProps & {
service: IssueTrackerIntegrationService;
};
export function IssueStatusIcon(props: Props) {
return (
<Icon size={props.size} className={props.className}>
{getIcon(props)}
</Icon>
);
}
function getIcon(props: Props) {
switch (props.service) {
case IntegrationService.GitHub:
return <GitHubIssueStatusIcon {...props} />;
case IntegrationService.Linear:
return <LinearIssueStatusIcon {...props} />;
}
}
const Icon = styled.span<{ size?: number }>`
display: inline-flex;
flex-shrink: 0;
width: ${(props) => props.size ?? 24}px;
height: ${(props) => props.size ?? 24}px;
align-items: center;
justify-content: center;
`;