-
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 #29 from simonyiszk/5-list-favorite-events
5 list favorite events
- Loading branch information
Showing
11 changed files
with
130 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
|
||
import { Screen } from '../../../components/base/screen'; | ||
import { ErrorMessage } from '../../../components/common/error-message'; | ||
import { Header } from '../../../components/common/header'; | ||
import { Title } from '../../../components/common/title'; | ||
import { PresentationItemSkeletonList } from '../../../components/schedule/layouts/presentation-item-skeleton-list'; | ||
import { PresentationList } from '../../../components/schedule/layouts/presentation-list'; | ||
import { useFavoritePresentationsList } from '../../../hooks/use-favorite-presentations-list'; | ||
|
||
export default function FavoritePresentationsScreen() { | ||
const { data, isLoading, isError } = useFavoritePresentationsList(); | ||
return ( | ||
<Screen> | ||
<Header> | ||
<Title>Kedvenc előadásaim</Title> | ||
</Header> | ||
{isLoading && <PresentationItemSkeletonList />} | ||
{!isError && !isLoading && <PresentationList presentations={data ?? []} />} | ||
{isError && <ErrorMessage>Nem sikerült betölteni az előadásokat</ErrorMessage>} | ||
</Screen> | ||
); | ||
} |
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,57 @@ | ||
import { Feather } from '@expo/vector-icons'; | ||
import { forwardRef } from 'react'; | ||
import { Pressable, PressableProps, View } from 'react-native'; | ||
|
||
import { colors } from '../../theme/colors'; | ||
import { cn } from '../../utils/common.utils'; | ||
import { StyledText } from '../base/text'; | ||
|
||
type ButtonVariant = 'primary' | 'outline'; | ||
|
||
const buttonStyles: Record<ButtonVariant, string> = { | ||
primary: 'bg-primary-500 active:bg-primary-600', | ||
outline: 'bg-transparent border-2 border-primary-500 active:bg-primary-100', | ||
}; | ||
|
||
const textStyles: Record<ButtonVariant, string> = { | ||
primary: 'text-white', | ||
outline: 'text-primary-500', | ||
}; | ||
|
||
interface StyledButtonProps extends Omit<PressableProps, 'children'> { | ||
children: string; | ||
leftIcon?: React.ComponentProps<typeof Feather>['name']; | ||
rightIcon?: React.ComponentProps<typeof Feather>['name']; | ||
variant?: keyof typeof buttonStyles; | ||
} | ||
|
||
const StyledButton = forwardRef<View, StyledButtonProps>( | ||
({ children, variant = 'primary', leftIcon, rightIcon, className, ...props }, ref) => { | ||
return ( | ||
<Pressable | ||
className={cn( | ||
buttonStyles[variant], | ||
'rounded-md', | ||
'px-4', | ||
'py-2', | ||
'shadow-md items-center justify-center flex-row space-x-2', | ||
className | ||
)} | ||
ref={ref} | ||
{...props} | ||
> | ||
{leftIcon && ( | ||
<Feather name={leftIcon} size={24} color={variant === 'primary' ? 'white' : colors.primary['500']} /> | ||
)} | ||
<StyledText className={cn(textStyles[variant], 'font-raleway-bold text-center text-lg')}>{children}</StyledText> | ||
{rightIcon && ( | ||
<Feather name={rightIcon} size={24} color={variant === 'primary' ? 'white' : colors.primary['500']} /> | ||
)} | ||
</Pressable> | ||
); | ||
} | ||
); | ||
|
||
StyledButton.displayName = 'StyledButton'; | ||
|
||
export { StyledButton }; |
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,9 @@ | ||
import { useFavoritePresentations } from '../contexts/favorite-presentations.context'; | ||
import { useConference } from './use-conference'; | ||
|
||
export function useFavoritePresentationsList() { | ||
const { data, ...rest } = useConference(); | ||
const { isFavoritePresentation } = useFavoritePresentations(); | ||
const items = data?.presentations.filter((item) => isFavoritePresentation(item.slug)); | ||
return { data: items, ...rest }; | ||
} |
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