import React from "react"; import Icon from "components/Icon"; import { QueryablePlatform } from "interfaces/platform"; import { DEFAULT_EMPTY_CELL_VALUE } from "utilities/constants"; interface IPlatformCellProps { platforms: QueryablePlatform[]; } const baseClass = "platform-cell"; const ICONS: Record = { darwin: "darwin", windows: "windows", linux: "linux", chrome: "chrome", }; const DISPLAY_ORDER: QueryablePlatform[] = [ "darwin", "windows", "linux", "chrome", // "None", // "Invalid query", ]; const PlatformCell = ({ platforms }: IPlatformCellProps): JSX.Element => { const orderedList = DISPLAY_ORDER.filter((platform) => platforms.includes(platform) ); return ( {orderedList.length ? ( orderedList.map((platform) => { return ICONS[platform] ? ( ) : null; }) ) : ( {DEFAULT_EMPTY_CELL_VALUE} )} ); }; export default PlatformCell;