import { AnchorTitle, colors, HeaderSizes } from '@0xproject/react-shared'; import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; import { Event, EventArg } from '../types'; import { Type } from './type'; export interface EventDefinitionProps { event: Event; sectionName: string; docsInfo: DocsInfo; } export interface EventDefinitionState { shouldShowAnchor: boolean; } export class EventDefinition extends React.Component { constructor(props: EventDefinitionProps) { super(props); this.state = { shouldShowAnchor: false, }; } public render(): React.ReactNode { const event = this.props.event; const id = `${this.props.sectionName}-${event.name}`; return (
                        {this._renderEventCode()}
                    
); } private _renderEventCode(): React.ReactNode { 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): void { this.setState({ shouldShowAnchor, }); } }