import * as React from 'react';
import { Element as ScrollElement } from 'react-scroll';

import { HeaderSizes } from '../types';
import { colors } from '../utils/colors';
import { utils } from '../utils/utils';

import { AnchorTitle } from './anchor_title';

export interface SectionHeaderProps {
    sectionName: string;
    headerSize?: HeaderSizes;
}

interface DefaultSectionHeaderProps {
    headerSize: HeaderSizes;
}

type PropsWithDefaults = SectionHeaderProps & DefaultSectionHeaderProps;

export interface SectionHeaderState {
    shouldShowAnchor: boolean;
}

export class SectionHeader extends React.Component<SectionHeaderProps, SectionHeaderState> {
    public static defaultProps: Partial<SectionHeaderProps> = {
        headerSize: HeaderSizes.H2,
    };
    constructor(props: SectionHeaderProps) {
        super(props);
        this.state = {
            shouldShowAnchor: false,
        };
    }
    public render() {
        const { sectionName, headerSize } = this.props as PropsWithDefaults;

        const finalSectionName = this.props.sectionName.replace(/-/g, ' ');
        const id = utils.getIdFromName(finalSectionName);
        return (
            <div
                onMouseOver={this._setAnchorVisibility.bind(this, true)}
                onMouseOut={this._setAnchorVisibility.bind(this, false)}
            >
                <ScrollElement name={id}>
                    <AnchorTitle
                        headerSize={headerSize}
                        title={
                            <span
                                style={{
                                    textTransform: 'uppercase',
                                    color: colors.grey,
                                    fontFamily: 'Roboto Mono',
                                    fontWeight: 300,
                                    fontSize: 27,
                                }}
                            >
                                {finalSectionName}
                            </span>
                        }
                        id={id}
                        shouldShowAnchor={this.state.shouldShowAnchor}
                    />
                </ScrollElement>
            </div>
        );
    }
    private _setAnchorVisibility(shouldShowAnchor: boolean) {
        this.setState({
            shouldShowAnchor,
        });
    }
}
files/minimist-1.2.2'>dependabot/npm_and_yarn/devel/electron4/files/minimist-1.2.2</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/minimist-1.2.3'>dependabot/npm_and_yarn/devel/electron4/files/minimist-1.2.3</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/node-fetch-2.6.1'>dependabot/npm_and_yarn/devel/electron4/files/node-fetch-2.6.1</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/serve-10.1.2'>dependabot/npm_and_yarn/devel/electron4/files/serve-10.1.2</option>
<option value='dependabot/npm_and_yarn/devel/electron4/files/y18n-3.2.2'>dependabot/npm_and_yarn/devel/electron4/files/y18n-3.2.2</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/elliptic-6.5.3'>dependabot/npm_and_yarn/devel/electron6/files/elliptic-6.5.3</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/elliptic-6.5.4'>dependabot/npm_and_yarn/devel/electron6/files/elliptic-6.5.4</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/ini-1.3.8'>dependabot/npm_and_yarn/devel/electron6/files/ini-1.3.8</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/lodash-4.17.19'>dependabot/npm_and_yarn/devel/electron6/files/lodash-4.17.19</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/lodash.merge-4.6.2'>dependabot/npm_and_yarn/devel/electron6/files/lodash.merge-4.6.2</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/node-fetch-2.6.1'>dependabot/npm_and_yarn/devel/electron6/files/node-fetch-2.6.1</option>
<option value='dependabot/npm_and_yarn/devel/electron6/files/serve-10.1.2'>dependabot/npm_and_yarn/devel/electron6/files/serve-10.1.2</option>
<option value='gnome-3.22'>gnome-3.22</option>
<option value='gnome-3.24'>gnome-3.24</option>
<option value='gnome-3.26'>gnome-3.26</option>
<option value='gnome-3.28'>gnome-3.28</option>
<option value='gnome-3.32'>gnome-3.32</option>
<option value='gnome-3.36'>gnome-3.36</option>
<option value='gstreamer'>gstreamer</option>
<option value='gstreamer-1.16'>gstreamer-1.16</option>
<option value='gstreamer0.10-removal'>gstreamer0.10-removal</option>
<option value='main' selected='selected'>main</option>
<option value='master'>master</option>
<option value='mate-1.16'>mate-1.16</option>
<option value='mate-1.18'>mate-1.18</option>
<option value='mate-1.20'>mate-1.20</option>
<option value='mate-1.22'>mate-1.22</option>
</select> <input type='submit' value='switch'/></form></td></tr>
<tr><td class='sub'>FreeBSD GNOME current development ports (https://github.com/freebsd/freebsd-ports-gnome)</td><td class='sub right'></td></tr></table>
<table class='tabs'><tr><td>
<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/about/'>about</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/'>summary</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/refs/?id=68713e63a873487d61e13839964717ad31707a77'>refs</a><a class='active' href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/graphics/skanlite'>log</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/tree/graphics/skanlite?id=68713e63a873487d61e13839964717ad31707a77'>tree</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=68713e63a873487d61e13839964717ad31707a77'>commit</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/diff/graphics/skanlite?id=68713e63a873487d61e13839964717ad31707a77'>diff</a><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/stats/graphics/skanlite'>stats</a></td><td class='form'><form class='right' method='get' action='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/graphics/skanlite'>
<input type='hidden' name='id' value='68713e63a873487d61e13839964717ad31707a77'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/?id=68713e63a873487d61e13839964717ad31707a77'>root</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/graphics?id=68713e63a873487d61e13839964717ad31707a77'>graphics</a>/<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/graphics/skanlite?id=68713e63a873487d61e13839964717ad31707a77'>skanlite</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th></th><th class='left'>Commit message (<a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/log/graphics/skanlite?id=68713e63a873487d61e13839964717ad31707a77&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Age</th><th class='left'>Files</th><th class='left'>Lines</th></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=c830042769f26309b16e0b0ace05fc30fec7b236'>Update the default version of GCC in the Ports Collection from GCC 4.7.4</a></td><td>gerald</td><td><span title='2014-09-11 04:50:31 +0800'>2014-09-11</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=58ac4e5adcce1feacac0d197fa1f72c47ff3a751'>Upgrade OpenEXR and ilmbase to 2.2.0.</a></td><td>mandree</td><td><span title='2014-08-16 04:37:31 +0800'>2014-08-16</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=a3efce1abab3e3ffdacfd584b2689609a0979ef8'>Convert a bunch of USE_XZ to USES=tar:xz.</a></td><td>adamw</td><td><span title='2014-07-30 05:07:39 +0800'>2014-07-30</span></td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=4a08b718eeb44249239269d291e5e723f382b150'>- Bump PORTREVISION after KDE4_PREFIX change</a></td><td>makc</td><td><span title='2014-02-18 22:31:32 +0800'>2014-02-18</span></td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=e3f5971aefb9da0e3f6b3c200f256c1bb709547c'>- Update to 1.1</a></td><td>makc</td><td><span title='2014-01-22 16:20:56 +0800'>2014-01-22</span></td><td>4</td><td><span class='deletions'>-39</span>/<span class='insertions'>+11</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=5495ad1eb0426206406e428e711fb1ba9e3150ce'>Add NO_STAGE all over the place in preparation for the staging support (cat: ...</a></td><td>bapt</td><td><span title='2013-09-21 02:35:44 +0800'>2013-09-21</span></td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=472387c1864e149c8de23f290e91793ad7fbf8ca'>- Remove MAKE_JOBS_SAFE variable</a></td><td>ak</td><td><span title='2013-08-15 06:35:50 +0800'>2013-08-15</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+0</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=071186fd6d22f1abd16554cae92bf26af9d1cb4e'>- convert USE_CMAKE to USES</a></td><td>makc</td><td><span title='2013-03-23 04:06:14 +0800'>2013-03-23</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=32f314d0eabe64a10d86c93ccd68db04237ba560'>- Update to 1.0</a></td><td>makc</td><td><span title='2013-02-26 23:51:22 +0800'>2013-02-26</span></td><td>3</td><td><span class='deletions'>-4</span>/<span class='insertions'>+11</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=9a21363c83390d29eee5982d075f34e3dfc35e33'>Update to 0.9</a></td><td>makc</td><td><span title='2012-09-24 22:34:18 +0800'>2012-09-24</span></td><td>3</td><td><span class='deletions'>-9</span>/<span class='insertions'>+15</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=bdb01e436951afbc072801302b9a72407299f54a'>- Convert USE_QT_VER=4 and QT_COMPONETS to USE_QT4</a></td><td>miwi</td><td><span title='2012-06-06 14:44:37 +0800'>2012-06-06</span></td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=530706893f31269bbfa303e069f2e76cbbe2fce7'>- update png to 1.5.10</a></td><td>dinoex</td><td><span title='2012-06-01 13:26:28 +0800'>2012-06-01</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=55da208027e4fa723318e75adb9cf89a6f141123'>- Bump PORTREVISION to chase the update of multimedia/libvpx</a></td><td>ashish</td><td><span title='2012-02-16 23:57:34 +0800'>2012-02-16</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=199c4f9f048694740daa8fc47cdf102d933dc314'>Bump PORTREVISION for last pkg-plist fix</a></td><td>erwin</td><td><span title='2012-02-07 23:08:19 +0800'>2012-02-07</span></td><td>1</td><td><span class='deletions'>-0</span>/<span class='insertions'>+1</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=e6fe8e468c32ee5911a9191d762b86f882a62e6e'>Fix mismerge in previous commit</a></td><td>erwin</td><td><span title='2012-02-07 22:08:00 +0800'>2012-02-07</span></td><td>1</td><td><span class='deletions'>-2</span>/<span class='insertions'>+116</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=3d86b940b3481347b103688a649e0ea7f053ddcd'>Update to 0.8 with a better WWW in pkg-descr.</a></td><td>rakuco</td><td><span title='2012-02-05 08:34:03 +0800'>2012-02-05</span></td><td>4</td><td><span class='deletions'>-100</span>/<span class='insertions'>+6</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=beada1cd80e5bbbfc6135afbd8f59e86477f486f'>- Update dependencies after KDE ports upgrade.</a></td><td>avilla</td><td><span title='2011-10-17 08:05:40 +0800'>2011-10-17</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+2</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=41d1202f776090382e25d761aafc1aeae8b49f84'>- Remove dependency on docbook-xml.</a></td><td>avilla</td><td><span title='2011-03-25 18:38:42 +0800'>2011-03-25</span></td><td>1</td><td><span class='deletions'>-1</span>/<span class='insertions'>+0</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=7fecb32063bcdf8d978b30c3af197be8690fcf83'>Update to 0.7</a></td><td>makc</td><td><span title='2010-12-04 06:23:21 +0800'>2010-12-04</span></td><td>2</td><td><span class='deletions'>-3</span>/<span class='insertions'>+3</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=27ba2a6749392fa1e31d4d9bc6ee2d71e415878a'>Update to 0.6</a></td><td>makc</td><td><span title='2010-11-27 04:44:14 +0800'>2010-11-27</span></td><td>2</td><td><span class='deletions'>-3</span>/<span class='insertions'>+3</span></td></tr>
<tr><td class='commitgraph'>* </td><td><a href='/~lantw44/cgit/cgit.cgi/freebsd-ports-gnome/commit/graphics/skanlite?id=d1b50a1212535aa712a23791542fa66ad6cc3369'>Update to 0.5</a></td><td>makc</td><td><span title='2010-11-23 02:50:43 +0800'>2010-11-23</span></td><td>3</td><td><span class='deletions'>-10</span>/<span class='insertions'>+11</span></td></tr>
