1+ import React , { useState } from 'react' ;
2+ import { Box , Text , useInput } from 'ink' ;
3+ import open from 'open' ;
4+ import Link from 'ink-link' ;
5+ import { theme } from '../style/theme.js' ;
6+ export default function Footer ( {
7+ version = 'dev' ,
8+ stars = 0 ,
9+ isFocused = false
10+ } ) {
11+ const [ selectedIndex , setSelectedIndex ] = useState ( 0 ) ;
12+ const links = [ {
13+ label : 'Greper' ,
14+ url : 'https://github.com/greper'
15+ } , {
16+ label : 'WangLiang' ,
17+ url : 'https://github.com/wangliang181230'
18+ } , {
19+ label : 'CuteOmega' ,
20+ url : 'https://github.com/cute-omega'
21+ } , {
22+ label : 'Project Home' ,
23+ url : 'https://github.com/docmirror/dev-sidecar'
24+ } ] ;
25+ useInput ( ( input , key ) => {
26+ if ( ! isFocused ) return ;
27+ if ( key . leftArrow ) {
28+ setSelectedIndex ( prev => Math . max ( 0 , prev - 1 ) ) ;
29+ }
30+ if ( key . rightArrow ) {
31+ setSelectedIndex ( prev => Math . min ( links . length - 1 , prev + 1 ) ) ;
32+ }
33+ if ( key . return ) {
34+ const link = links [ selectedIndex ] ;
35+ if ( link ) {
36+ open ( link . url ) ;
37+ }
38+ }
39+ } ) ;
40+ return /*#__PURE__*/ React . createElement ( Box , {
41+ flexDirection : "column" ,
42+ borderStyle : "single" ,
43+ borderTop : true ,
44+ borderBottom : false ,
45+ borderLeft : false ,
46+ borderRight : false ,
47+ borderColor : isFocused ? theme . colors . accent : 'gray' ,
48+ paddingTop : 1 ,
49+ marginTop : 1
50+ } , /*#__PURE__*/ React . createElement ( Box , {
51+ justifyContent : "space-between"
52+ } , /*#__PURE__*/ React . createElement ( Text , {
53+ color : theme . colors . muted
54+ } , "\xA92020-2026 docmirror.cn \u2014 " , version ) , /*#__PURE__*/ React . createElement ( Box , null , /*#__PURE__*/ React . createElement ( Text , {
55+ color : theme . colors . muted
56+ } , "Authors: " ) , links . slice ( 0 , 3 ) . map ( ( link , index ) => /*#__PURE__*/ React . createElement ( Box , {
57+ key : link . label ,
58+ marginRight : 1
59+ } , index > 0 && /*#__PURE__*/ React . createElement ( Text , null , ", " ) , /*#__PURE__*/ React . createElement ( Link , {
60+ url : link . url
61+ } , /*#__PURE__*/ React . createElement ( Text , {
62+ backgroundColor : selectedIndex === index && isFocused ? theme . colors . accent : undefined ,
63+ color : selectedIndex === index && isFocused ? theme . colors . background : theme . colors . text ,
64+ bold : selectedIndex === index && isFocused ,
65+ underline : selectedIndex === index && isFocused
66+ } , link . label ) ) ) ) ) ) , /*#__PURE__*/ React . createElement ( "br" , null ) , /*#__PURE__*/ React . createElement ( Box , {
67+ marginTop : 1 ,
68+ justifyContent : "flex-end"
69+ } , /*#__PURE__*/ React . createElement ( Text , null , "\u5982\u679C\u5B83\u89E3\u51B3\u4E86\u4F60\u7684\u95EE\u9898\uFF0C\u8BF7\u4E0D\u8981\u541D\u556C\u4F60\u7684star\u54DF\uFF01\u70B9\u8FD9\u91CC" , '->' ) , /*#__PURE__*/ React . createElement ( Box , {
70+ marginLeft : 1
71+ } , /*#__PURE__*/ React . createElement ( Link , {
72+ url : links [ 3 ] . url
73+ } , /*#__PURE__*/ React . createElement ( Text , {
74+ backgroundColor : selectedIndex === 3 && isFocused ? theme . colors . accent : undefined ,
75+ color : selectedIndex === 3 && isFocused ? theme . colors . background : theme . colors . logo ,
76+ bold : selectedIndex === 3 && isFocused ,
77+ underline : selectedIndex === 3 && isFocused
78+ } , "[Stars: " , stars , "]" ) ) ) ) , isFocused && /*#__PURE__*/ React . createElement ( Text , {
79+ color : "gray" ,
80+ dimColor : true
81+ } , "(Use Left/Right to select, Enter to open)" ) ) ;
82+ }
0 commit comments