import * as _ from 'lodash'; import RaisedButton from 'material-ui/RaisedButton'; import * as React from 'react'; import * as ReactMarkdown from 'react-markdown'; import { Element as ScrollElement } from 'react-scroll'; import { AnchorTitle } from 'ts/pages/shared/anchor_title'; import { MarkdownCodeBlock } from 'ts/pages/shared/markdown_code_block'; import { MarkdownLinkBlock } from 'ts/pages/shared/markdown_link_block'; import { HeaderSizes } from 'ts/types'; import { colors } from 'ts/utils/colors'; import { utils } from 'ts/utils/utils'; interface MarkdownSectionProps { sectionName: string; markdownContent: string; headerSize?: HeaderSizes; githubLink?: string; } interface MarkdownSectionState { shouldShowAnchor: boolean; } export class MarkdownSection extends React.Component { public static defaultProps: Partial = { headerSize: HeaderSizes.H3, }; constructor(props: MarkdownSectionProps) { super(props); this.state = { shouldShowAnchor: false, }; } public render() { const sectionName = this.props.sectionName; const id = utils.getIdFromName(sectionName); return (
{!_.isUndefined(this.props.githubLink) && ( Edit on Github )}

); } private _setAnchorVisibility(shouldShowAnchor: boolean) { this.setState({ shouldShowAnchor, }); } }