import React from "react"; import { ConditionName } from "@dndbeyond/character-components/es"; import { CharacterTheme, Condition, ConditionUtils, } from "@dndbeyond/character-rules-engine/es"; interface Props { conditions: Array; onClick: () => void; theme: CharacterTheme; } export default class ConditionsSummary extends React.PureComponent { handleClick = (evt: React.MouseEvent): void => { const { onClick } = this.props; if (onClick) { evt.stopPropagation(); evt.nativeEvent.stopImmediatePropagation(); onClick(); } }; renderConditions = (): React.ReactNode => { const { conditions, theme } = this.props; return ( {conditions.map((condition) => ( ))} ); }; renderDefault = (): React.ReactNode => { const { theme } = this.props; return (
Add Active Conditions
); }; render() { const { conditions } = this.props; let contentNode: React.ReactNode; if (conditions.length) { contentNode = this.renderConditions(); } else { contentNode = this.renderDefault(); } return (
{contentNode}
); } }