@@ -13,13 +13,14 @@ import { themes } from '@stardust-ui/react'
1313import { ThemeContext } from '../../context/theme-context'
1414import { constants } from 'src/lib'
1515
16+ type ComponentMenuItem = { displayName : string ; type : string }
17+
1618const pkg = require ( '../../../../package.json' )
17- const componentMenu = require ( 'docs/src/componentMenu' )
18- const behaviorMenu = require ( 'docs/src/behaviorMenu' )
19+ const componentMenu : ComponentMenuItem [ ] = require ( 'docs/src/componentMenu' )
20+ const behaviorMenu : ComponentMenuItem [ ] = require ( 'docs/src/behaviorMenu' )
1921
2022const selectedItemLabelStyle : any = { color : '#35bdb2' , float : 'right' }
2123const selectedItemLabel = < span style = { selectedItemLabelStyle } > Press Enter</ span >
22- type ComponentMenuItem = { displayName : string ; type : string }
2324
2425class Sidebar extends React . Component < any , any > {
2526 static propTypes = {
@@ -51,7 +52,7 @@ class Sidebar extends React.Component<any, any> {
5152 this . _searchInput = ( findDOMNode ( this ) as any ) . querySelector ( '.ui.input input' )
5253 }
5354
54- handleDocumentKeyDown = e => {
55+ private handleDocumentKeyDown = e => {
5556 const code = keyboardKey . getCode ( e )
5657 const isAZ = code >= 65 && code <= 90
5758 const hasModifier = e . altKey || e . ctrlKey || e . metaKey
@@ -60,20 +61,20 @@ class Sidebar extends React.Component<any, any> {
6061 if ( ! hasModifier && isAZ && bodyHasFocus ) this . _searchInput . focus ( )
6162 }
6263
63- handleItemClick = ( ) => {
64+ private handleItemClick = ( ) => {
6465 const { query } = this . state
6566
6667 if ( query ) this . setState ( { query : '' } )
6768 if ( document . activeElement === this . _searchInput ) this . _searchInput . blur ( )
6869 }
6970
70- handleSearchChange = e =>
71+ private handleSearchChange = e =>
7172 this . setState ( {
7273 selectedItemIndex : 0 ,
7374 query : e . target . value ,
7475 } )
7576
76- handleSearchKeyDown = e => {
77+ private handleSearchKeyDown = e => {
7778 const { history } = this . props
7879 const { selectedItemIndex } = this . state
7980 const code = keyboardKey . getCode ( e )
@@ -101,9 +102,9 @@ class Sidebar extends React.Component<any, any> {
101102 }
102103 }
103104
104- menuItemsByType = _ . map ( nextType => {
105+ private menuItemsByType = _ . map ( nextType => {
105106 const items = _ . flow (
106- _ . filter ( ( { type } ) => type === nextType ) ,
107+ _ . filter < ComponentMenuItem > ( ( { type } ) => type === nextType ) ,
107108 _ . map ( info => (
108109 < Menu . Item
109110 key = { info . displayName }
@@ -124,7 +125,7 @@ class Sidebar extends React.Component<any, any> {
124125 )
125126 } , constants . typeOrder )
126127
127- renderSearchItems = ( ) => {
128+ private renderSearchItems = ( ) => {
128129 const { selectedItemIndex, query } = this . state
129130 if ( ! query ) return undefined
130131
0 commit comments