diff --git a/src/js/menu.tsx b/src/js/menu.tsx index bc947e3..59d5dc0 100644 --- a/src/js/menu.tsx +++ b/src/js/menu.tsx @@ -3,43 +3,37 @@ import React from "react"; type StreamSelectCallback = (selected: string) => void -type MenuProps = { +interface MenuProps { items: string[] - selectedItem: string | undefined + selectedItem: string | null selectCallback: StreamSelectCallback } -export class Menu extends React.Component { - constructor(props: MenuProps) { - super(props) - } - - render() { - return ( - - ) - } - - private menuitems() { +export function Menu({ items, selectedItem, selectCallback }: MenuProps) { + const menuitems = () => { return ( <> - {this.props.items.map((value, idx) => { - if (this.props.selectedItem == value) { + {items.map((value, idx) => { + if (selectedItem == value) { return
  • {value}
  • } else { return
  • { - this.props.selectCallback(value) + selectCallback(value) }} className="menu-item">{value}
  • } })} ) } + return ( + + ) + }