2021-10-25 18:00:32 +00:00
|
|
|
import React from "react";
|
2022-11-18 17:21:13 +00:00
|
|
|
import Icon from "components/Icon";
|
2021-10-25 18:00:32 +00:00
|
|
|
|
|
|
|
|
interface IPlatformCellProps {
|
|
|
|
|
value: string[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const baseClass = "platform-cell";
|
|
|
|
|
|
2023-06-06 12:58:32 +00:00
|
|
|
const ICONS: Record<string, "darwin" | "windows" | "linux" | "chrome"> = {
|
2022-11-18 17:21:13 +00:00
|
|
|
darwin: "darwin",
|
|
|
|
|
windows: "windows",
|
2023-06-06 12:58:32 +00:00
|
|
|
linux: "linux",
|
|
|
|
|
chrome: "chrome",
|
2021-10-25 18:00:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const DISPLAY_ORDER = [
|
|
|
|
|
"darwin",
|
|
|
|
|
"windows",
|
2023-06-06 12:58:32 +00:00
|
|
|
"linux",
|
|
|
|
|
"chrome",
|
2021-10-25 18:00:32 +00:00
|
|
|
// "None",
|
|
|
|
|
// "Invalid query",
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const PlatformCell = ({
|
|
|
|
|
value: platforms,
|
|
|
|
|
}: IPlatformCellProps): JSX.Element => {
|
|
|
|
|
const orderedList = DISPLAY_ORDER.filter((platform) =>
|
|
|
|
|
platforms.includes(platform)
|
|
|
|
|
);
|
|
|
|
|
return (
|
2022-04-07 19:12:38 +00:00
|
|
|
<span className={`${baseClass}__wrapper`}>
|
2021-10-25 18:00:32 +00:00
|
|
|
{orderedList.length ? (
|
|
|
|
|
orderedList.map((platform) => {
|
|
|
|
|
return ICONS[platform] ? (
|
2022-11-18 17:21:13 +00:00
|
|
|
<Icon
|
2021-10-25 18:00:32 +00:00
|
|
|
className={`${baseClass}__icon`}
|
2022-11-18 17:21:13 +00:00
|
|
|
name={ICONS[platform]}
|
|
|
|
|
size="small"
|
2022-12-07 17:59:38 +00:00
|
|
|
key={ICONS[platform]}
|
2021-10-25 18:00:32 +00:00
|
|
|
/>
|
|
|
|
|
) : null;
|
|
|
|
|
})
|
|
|
|
|
) : (
|
|
|
|
|
<span className={`${baseClass}__muted`}>---</span>
|
|
|
|
|
)}
|
|
|
|
|
</span>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default PlatformCell;
|