import * as React from "react"; import {ReactComponentBase} from "tc-shared/ui/elements/ReactComponentBase"; const cssStyle = require("./button.scss"); export interface DropdownEntryProperties { icon?: string | JQuery; text: JSX.Element | string; onClick?: (event) => void; onContextMenu?: (event) => void; } class IconRenderer extends React.Component<{ icon: string | JQuery }, {}> { private readonly icon_ref: React.RefObject; constructor(props) { super(props); if(typeof this.props.icon === "object") this.icon_ref = React.createRef(); } render() { if(!this.props.icon) return
; else if(typeof this.props.icon === "string") return
; return
; } componentDidMount(): void { if(this.icon_ref) $(this.icon_ref.current).replaceWith(this.props.icon); } componentWillUnmount(): void { if(this.icon_ref) $(this.icon_ref.current).empty(); } } export class DropdownEntry extends ReactComponentBase { protected default_state() { return {}; } render() { if(this.props.children) { return (
{this.props.text}
{this.props.children}
); } else { return ( ); } } } export interface DropdownContainerProperties { } export interface DropdownContainerState { } export class DropdownContainer extends ReactComponentBase { protected default_state() { return { }; } render() { return (
{this.props.children}
); } }