// @flow import * as ICONS from 'constants/icons'; import classnames from 'classnames'; import React from 'react'; import ChannelThumbnail from 'component/channelThumbnail'; import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button'; import ChannelTitle from 'component/channelTitle'; import Icon from 'component/common/icon'; type Props = { selectedChannelUrl: string, // currently selected channel channels: ?Array, onChannelSelect: (url: string) => void, }; type ListItemProps = { uri: string, isSelected?: boolean, }; function ChannelListItem(props: ListItemProps) { const { uri, isSelected = false } = props; return (
{isSelected && }
); } function ChannelSelector(props: Props) { const { channels, selectedChannelUrl, onChannelSelect } = props; if (!channels || !selectedChannelUrl) { return null; } return ( {channels && channels.map(channel => ( { if (selectedChannelUrl !== channel.canonical_url) { onChannelSelect(channel.canonical_url); } }} > ))} ); } export default ChannelSelector;