Skip to content

Commit

Permalink
feat: 예약 가능 식당 목록에서 이모지 랜덤 표시
Browse files Browse the repository at this point in the history
  • Loading branch information
potados99 committed Feb 1, 2022
1 parent dd4566e commit f1fe9bf
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
34 changes: 34 additions & 0 deletions src/common/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,38 @@ export default {
version: {
minimumSupported: Platform.OS === 'ios' ? 'iOS 12.0' : 'Android 8.0',
},

emoji: {
bank: [
'😉',
'☺️',
'😁',
'😆',
'🤩',
'🤗',
'😎',
'😋',
'😝',
'🤓',
'🥳',
'👊',
'👍',
'🤟',
'✨',
'🌟',
'⭐',
'🍟',
'🍗',
'🍜',
'🍣',
'🍿',
'🎂',
'🥔',
'🍥',
'🍽',
'🍴',
'🎃',
'🎉',
],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import React from 'react';
import colors from '../../../res/colors';
import Config from '../../../../common/Config';
import palette from '../../../res/palette';
import {Button} from 'react-native-paper';
import CardView from '../../../components/CardView';
import {randomPick} from '../../../../common/utils/Array';
import PaperPresets from '../../../components/utils/PaperPresets';
import CafeteriaView from '../../cafeteria/CafeteriaView';
import React, {useState} from 'react';
import {StyleSheet, Text} from 'react-native';
import {StackNavigationProp} from '@react-navigation/stack';
import {BookingNavigationParams} from '../BookingScreen';
import PaperPresets from '../../../components/utils/PaperPresets';

type Props = {
navigation: StackNavigationProp<BookingNavigationParams, 'BookingOptionsList'>;
Expand All @@ -35,10 +37,15 @@ type Props = {

export default function BookableCafeteriaItem({navigation, cafeteria}: Props) {
const goToDetails = () => navigation.navigate('BookingOptionsDetail', {cafeteria});
const nextEmoji = () => randomPick(Config.emoji.bank);

const [emoji, setEmoji] = useState(nextEmoji());

return (
<CardView style={styles.container}>
<Text style={styles.emojiText}>😋</Text>
<Text style={styles.emojiText} onPress={() => setEmoji(nextEmoji())}>
{emoji}
</Text>
<Text style={styles.titleText}>{cafeteria.displayName}</Text>
<Text style={styles.descriptionText}>{cafeteria.comment}</Text>
<Button {...PaperPresets.wideThemedButton} style={styles.makeBookingButton} onPress={goToDetails}>
Expand Down Expand Up @@ -74,7 +81,6 @@ const styles = StyleSheet.create({
color: colors.white,
paddingVertical: 4,
},

makeBookingButton: {
alignSelf: 'stretch',
marginTop: 21,
Expand Down

0 comments on commit f1fe9bf

Please sign in to comment.