-
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.
Merge pull request #50 from simonyiszk/qna-button-highlight
feat: add qna button highlight
- Loading branch information
Showing
4 changed files
with
49 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,59 @@ | ||
import { Feather } from '@expo/vector-icons'; | ||
import { useNavigation } from 'expo-router'; | ||
import { Pressable } from 'react-native'; | ||
import { useState } from 'react'; | ||
import { Animated, Pressable, View } from 'react-native'; | ||
import { NativeStackNavigationProp } from 'react-native-screens/native-stack'; | ||
|
||
import { extendedColors } from '../../../theme/extendedColors'; | ||
import { usePulseAnimation } from '../../../utils/animation.utils'; | ||
import { cn } from '../../../utils/common.utils'; | ||
import { ItemCard } from '../../base/item-card'; | ||
import { StyledText } from '../../base/text'; | ||
|
||
interface QnaButtonProps { | ||
slug: string; | ||
highlight?: boolean; | ||
} | ||
|
||
export function QnaButton({ slug }: QnaButtonProps) { | ||
export function QnaButton({ slug, highlight }: QnaButtonProps) { | ||
const [promptOpen, setPromptOpen] = useState(highlight ?? false); | ||
const animation = usePulseAnimation(1000); | ||
const router = useNavigation<NativeStackNavigationProp<{ qna: { id: string } }>>(); | ||
const onPress = () => { | ||
router.navigate('qna', { id: slug }); | ||
}; | ||
return ( | ||
<Pressable onPress={onPress}> | ||
<Feather name='message-circle' color={extendedColors.slate['500']} size={30} /> | ||
</Pressable> | ||
<View className='relative'> | ||
<Pressable onPress={onPress}> | ||
<Animated.View | ||
style={{ | ||
opacity: highlight ? animation.opacity : 1, | ||
}} | ||
className={cn({ | ||
'bg-primary-500 rounded-full p-2': highlight, | ||
})} | ||
> | ||
<Feather | ||
name='message-circle' | ||
color={highlight ? 'white' : extendedColors.slate[500]} | ||
size={highlight ? 26 : 30} | ||
/> | ||
</Animated.View> | ||
</Pressable> | ||
{promptOpen && ( | ||
<ItemCard | ||
onPress={onPress} | ||
className='absolute top-full right-1/2 shadow-md w-40 rounded-tr-none flex-row items-center space-x-2' | ||
> | ||
<Pressable onPress={() => setPromptOpen(false)}> | ||
<Feather name='x' size={20} color={extendedColors.slate[300]} /> | ||
</Pressable> | ||
<View> | ||
<StyledText className='text-xl font-raleway-bold'>Kérdezz</StyledText> | ||
<StyledText>az előadótól!</StyledText> | ||
</View> | ||
</ItemCard> | ||
)} | ||
</View> | ||
); | ||
} |
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