mirror of
https://github.com/outline/outline.git
synced 2026-04-29 14:09:31 -05:00
e503225f04
* Tidying hover card layout * Handle backticks in titles (common on GitHub + Linear) * Improve label display
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import * as React from "react";
|
|
import styled from "styled-components";
|
|
import {
|
|
IntegrationService,
|
|
IssueTrackerIntegrationService,
|
|
UnfurlResourceType,
|
|
UnfurlResponse,
|
|
} 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;
|
|
`;
|