-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
8 changed files
with
231 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, {useState} from 'react'; | ||
import {Text, Box, useInput, Newline} from 'ink'; | ||
import shoplist from './examples/shoplist.js'; | ||
import theme from './Theme.js'; | ||
|
||
const StationDetailType = ({station, setlist, setStation}) => { | ||
const [num, setNum] = useState(1); | ||
const [type, setType] = useState(''); | ||
|
||
useInput((input, key) => { | ||
if (!key) return; | ||
|
||
if (key.downArrow) { | ||
if (num < 4) { | ||
setNum(num + 1); | ||
} | ||
} else if (key.upArrow) { | ||
if (num > 1) { | ||
setNum(num - 1); | ||
} | ||
} | ||
|
||
if (key.return) { | ||
if (num === 1) { | ||
setType('맛집'); | ||
setlist(list => [...list, [shoplist, `${station} 맛집`]]); | ||
setStation(''); | ||
} else if (num === 2) { | ||
setType('카페'); | ||
setlist(list => [...list, [shoplist, `${station} 카페`]]); | ||
setStation(''); | ||
} else if (num === 3) { | ||
setType('액티비티'); | ||
setlist(list => [...list, [shoplist, `${station} 액티비티`]]); | ||
setStation(''); | ||
} else if (num === 4) { | ||
setType('술집'); | ||
setlist(list => [...list, [shoplist, `${station} 술집`]]); | ||
setStation(''); | ||
} | ||
} | ||
}); | ||
return ( | ||
<Box flexDirection="column"> | ||
<Text color="#00FF19">< {station} ></Text> | ||
<Box marginY={1} flexDirection="column"> | ||
<Text color={num == 1 ? theme.purple : theme.neonGreen}>1. 맛집</Text> | ||
<Text color={num == 2 ? theme.purple : theme.neonGreen}>2. 카페</Text> | ||
<Text color={num == 3 ? theme.purple : theme.neonGreen}> | ||
3. 액티비티 | ||
</Text> | ||
<Text color={num == 4 ? theme.purple : theme.neonGreen}>4. 술집</Text> | ||
</Box> | ||
{type ? <Text color="red"> ==> {type}</Text> : ''} | ||
</Box> | ||
); | ||
}; | ||
|
||
export default StationDetailType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from 'react'; | ||
import {Text, Box, Newline} from 'ink'; | ||
import theme from '../Theme.js'; | ||
|
||
const ListShop = ({data, key}) => { | ||
return ( | ||
<React.Fragment key={key}> | ||
<Text>{'{'}</Text> | ||
<Box marginLeft={2}> | ||
<Text> | ||
<Text> | ||
"id" : "{data.id}", | ||
<Newline /> | ||
</Text> | ||
<Text> | ||
"title" : "{data.title}", | ||
<Newline /> | ||
</Text> | ||
<Text marginLeft={2}> | ||
"location" : "{data.location}", | ||
<Newline /> | ||
</Text> | ||
<Text> | ||
"nearStation" : "{data.nearStation}", | ||
<Newline /> | ||
</Text> | ||
<Text> | ||
"menu" : {'['} | ||
<Newline /> | ||
{data.menu.map((item, index, array) => ( | ||
<Text key={item.name}> | ||
{' '} | ||
{'{'} "{item.name}" : {item.price} {'}'} | ||
{index !== array.length - 1 ? ',' : ''} | ||
<Newline /> | ||
</Text> | ||
))} | ||
{']'}, | ||
<Newline /> | ||
</Text> | ||
<Text> | ||
"starRate" : "{data.starRate}", | ||
<Newline /> | ||
</Text> | ||
</Text> | ||
</Box> | ||
<Text>{'}'}</Text> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export default ListShop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import {Text, Box, Newline} from 'ink'; | ||
import theme from '../Theme.js'; | ||
|
||
const ListSubway = ({data, key}) => { | ||
return ( | ||
<React.Fragment key={key}> | ||
<Text bold color={theme.neonGreen}> | ||
{data} | ||
{/* {data || data.original_title} */} | ||
</Text> | ||
<Newline /> | ||
</React.Fragment> | ||
); | ||
}; | ||
|
||
export default ListSubway; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
export default [ | ||
{ | ||
id: 1423, | ||
title: 'The 5th Wave', | ||
location: '서울시 동작구 상도로 369', | ||
nearStation: '상도역', | ||
menu: [ | ||
{ | ||
name: '카페라떼', | ||
price: 4000, | ||
}, | ||
], | ||
starRate: 4.5, | ||
recommend: 243, | ||
}, | ||
{ | ||
id: 24523, | ||
title: '정육면체', | ||
location: '서울시 중구 1-11', | ||
nearStation: '동대문역사문화공원역', | ||
menu: [ | ||
{ | ||
name: '카페라떼', | ||
price: 3000, | ||
}, | ||
], | ||
starRate: 3.4, | ||
recommend: 111, | ||
}, | ||
{ | ||
id: 625523, | ||
title: '어라라라', | ||
location: '서울시 용산구 5-6161', | ||
nearStation: '남영역', | ||
menu: [ | ||
{ | ||
name: '카페라떼', | ||
price: 9000, | ||
}, | ||
], | ||
starRate: 5.0, | ||
recommend: 1551, | ||
}, | ||
]; |