import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from 'ts/pages/documentation/docs_info'; import { Type } from 'ts/pages/documentation/type'; import { AnchorTitle } from 'ts/pages/shared/anchor_title'; import { Event, EventArg, HeaderSizes } from 'ts/types'; import { colors } from 'ts/utils/colors'; interface EventDefinitionProps { event: Event; sectionName: string; docsInfo: DocsInfo; } interface EventDefinitionState { shouldShowAnchor: boolean; } export class EventDefinition extends React.Component { constructor(props: EventDefinitionProps) { super(props); this.state = { shouldShowAnchor: false, }; } public render() { const event = this.props.event; return (
                        {this._renderEventCode()}
                    
); } private _renderEventCode() { const indexed = indexed; const eventArgs = _.map(this.props.event.eventArgs, (eventArg: EventArg) => { const type = ( ); return ( {eventArg.name} {eventArg.isIndexed ? indexed : ''}: {type}, ); }); const argList = _.reduce(eventArgs, (prev: React.ReactNode, curr: React.ReactNode) => { return [prev, '\n\t', curr]; }); return ( {`{`}
{'\t'} {argList}
{`}`}
); } private _setAnchorVisibility(shouldShowAnchor: boolean) { this.setState({ shouldShowAnchor, }); } }