Skip to content

Commit

Permalink
Run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
adityapawar1 committed Apr 24, 2024
1 parent eb9854f commit cfbda99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
14 changes: 7 additions & 7 deletions src/components/FavoriteStoryButton/FavoriteStoryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function FavoriteStoryButton({
storyId,
}: FavoriteStoryButtonProps) {
const { user } = useSession();
const { publish } = usePubSub()
const { publish } = usePubSub();
const [storyIsFavorited, setStoryIsFavorited] = useState(false);

useEffect(() => {
Expand All @@ -29,7 +29,7 @@ export default function FavoriteStoryButton({

useEffect(() => {
isStoryInFavorites(storyId, user?.id).then(storyInFavorites => {
setStoryIsFavorited(storyInFavorites)
setStoryIsFavorited(storyInFavorites);
publish(Channel.FAVORITES, storyId, storyInFavorites);
});
}, [storyId]);
Expand All @@ -54,8 +54,8 @@ export default function FavoriteStoryButton({
fill="#EB563B"
/>
</Svg>
)
}
);
};

const renderNotFavoritedIcon = () => {
return (
Expand All @@ -65,12 +65,12 @@ export default function FavoriteStoryButton({
fill="black"
/>
</Svg>
)
}
);
};

return (
<TouchableOpacity onPress={() => favoriteStory(!storyIsFavorited)}>
{storyIsFavorited ? renderFavoritedIcon() : renderNotFavoritedIcon()}
</TouchableOpacity >
</TouchableOpacity>
);
}
11 changes: 5 additions & 6 deletions src/components/SaveStoryButton/SaveStoryButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type SaveStoryButtonProps = {
defaultState?: boolean | null;
};


export default function SaveStoryButton({
storyId,
defaultState = null,
Expand Down Expand Up @@ -61,8 +60,8 @@ export default function SaveStoryButton({
fill="#703929"
/>
</Svg>
)
}
);
};

const renderSaveStoryImage = () => {
return (
Expand All @@ -72,12 +71,12 @@ export default function SaveStoryButton({
fill="black"
/>
</Svg>
)
}
);
};

return (
<TouchableOpacity onPress={() => saveStory(!storyIsSaved)}>
{storyIsSaved ? renderSavedStoryImage() : renderSaveStoryImage()}
</TouchableOpacity >
</TouchableOpacity>
);
}

0 comments on commit cfbda99

Please sign in to comment.