1- import { useCallback , useEffect , useState } from 'react' ;
1+ import { FC , useCallback , useEffect , useState } from 'react' ;
22import { Node } from 'typescript' ;
33import './index.css' ;
44import { queryCode } from './engine' ;
55import QueryEditor from './QueryEditor' ;
66import Code , { HighlightedInterval , HighlightedIntervals } from './Code' ;
77import { isSyntaxError } from './tsquery-util' ;
8+ import Header from './Header' ;
89
910const REG_EXPS : Record < string , RegExp > = {
1011 AllLineBreaks : / \n / g,
@@ -16,7 +17,7 @@ const REG_EXPS: Record<string, RegExp> = {
1617 OnlyWhitespace : / ^ \s * $ / ,
1718} ;
1819
19- export default function App ( ) {
20+ const App : FC = ( ) => {
2021 const [ highlightedIntervals , setHighlightedIntervals ] = useState < HighlightedIntervals > ( [ ] ) ;
2122 const [ query , setQuery ] = useState < string > ( '' ) ;
2223 const [ code , setCode ] = useState < string > ( '' ) ;
@@ -54,20 +55,16 @@ export default function App() {
5455 // Layout
5556 return (
5657 < div className = "App" >
57- < header >
58- < h1 > TSQuery Playground</ h1 >
59- < aside >
60- < a href = "https://github.com/phenomnomnominal/tsquery#selectors" > Reference</ a >
61- < a href = "https://github.com/flycode-org/tsquery-playground" > GitHub</ a >
62- </ aside >
63- </ header >
58+ < Header />
6459 < h2 > Query</ h2 >
6560 < QueryEditor onChange = { handleQueryChange } />
6661 < h2 > Code</ h2 >
6762 < Code highlighted = { highlightedIntervals } onChange = { handleCodeChange } />
6863 </ div >
6964 ) ;
70- }
65+ } ;
66+
67+ export default App ;
7168
7269function mapNodeToHighlightInterval ( node : Node ) : HighlightedInterval {
7370 const fullText = node . getFullText ( ) ;
0 commit comments