Skip to content

feat: 이미지 없을 경우 로고 표시 #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/react-native/src/components/common/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { getDisplayRegion } from '@/utils/getDisplayRegionName';
import useSpotLikeMutation from '@/apis/mutations/useSpotLikeMutation';
import MutationLoadingModal from './MutationLoadingModal';
import { MySpotResponse } from '@/apis/queries/mypage/useMySpotsQuery';
import SPOTLogo from '@/assets/SPOTLogo';

interface CardProps {
data: SpotCardData | MySpotResponse;
Expand Down Expand Up @@ -74,7 +75,7 @@ function Default({ data, size = 260 }: CardProps) {
return (
<ImageBackground
source={{ uri: posterUrl }}
className="rounded-2xl overflow-hidden bg-SPOT-black"
className={`rounded-2xl overflow-hidden ${!posterUrl ? 'bg-SPOT-red' : 'bg-SPOT-black'}`}
style={{ width: size, aspectRatio: 3 / 4 }}
>
<MutationLoadingModal
Expand All @@ -87,6 +88,11 @@ function Default({ data, size = 260 }: CardProps) {
}
activeOpacity={1}
>
{!posterUrl && (
<View className="items-center justify-center top-5 flex-1">
<SPOTLogo width={100} color="black" />
</View>
)}
<View className="flex-row justify-end items-center">
<TouchableOpacity
className="flex-row items-center p-2"
Expand Down
8 changes: 7 additions & 1 deletion packages/react-native/src/components/detail/AroundCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ImageBackground, TouchableOpacity, View } from 'react-native';
import { Font, CheckBox } from 'design-system';
import { SpotResponse } from '@/apis/queries/spot/useSpotDetailQuery';
import DotMenuIcon from '@/assets/DotMenuIcon';
import SPOTLogo from '@/assets/SPOTLogo';

interface AroundCardProps {
data: SpotResponse;
Expand All @@ -25,7 +26,7 @@ export default function AroundCard({
return (
<ImageBackground
source={{ uri: image }}
className="w-[120px] h-[160px] rounded-lg overflow-hidden"
className={`w-[120px] h-[160px] rounded-lg overflow-hidden ${!image ? 'bg-SPOT-red' : 'bg-SPOT-black'}`}
>
<TouchableOpacity
className="flex-1 justify-end bg-black/30"
Expand All @@ -43,6 +44,11 @@ export default function AroundCard({
/>
</View>
)}
{!image && (
<View className="items-center -top-3">
<SPOTLogo width={50} color="black" />
</View>
)}
<View className="p-2 bg-[#191919]">
<Font.Bold type="body1" color="white" ellipsis>
{title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { StackNavigation } from '@/types/navigation';
import { getDisplayRegion } from '@/utils/getDisplayRegionName';
import useToggle from '@/hooks/useToggle';
import FilterExperienceModal from './FilterExperienceModal';
import SPOTLogo from '@/assets/SPOTLogo';

interface QuizCardProps {
quizData: QuizzesResponse;
Expand Down Expand Up @@ -57,7 +58,13 @@ export default function QuizCard({ quizData }: QuizCardProps) {
borderTopLeftRadius: 25,
borderTopRightRadius: 25,
}}
className="bg-SPOT-red/30"
/>
{!quizData.imageUrl && (
<View className="items-center justify-center absolute w-full h-3/4">
<SPOTLogo color="black" />
</View>
)}
<View className="bg-[#191919] rounded-b-3xl p-3">
<View className="flex gap-1">
<View className="justify-center items-center gap-1 flex flex-col">
Expand Down
6 changes: 5 additions & 1 deletion packages/react-native/src/components/mypage/MySpotBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import HeartIcon from '@/assets/HeartIcon';
import { StackNavigation } from '@/types/navigation';
import { getDisplayRegion } from '@/utils/getDisplayRegionName';
import MutationLoadingModal from '../common/MutationLoadingModal';
import SPOTLogo from '@/assets/SPOTLogo';

interface MySpotBlockProps {
mySpot: MySpotResponse;
Expand Down Expand Up @@ -78,7 +79,7 @@ export default function MySpotBlock({ mySpot, width, gap }: MySpotBlockProps) {
<ImageBackground
source={{ uri: posterUrl }}
style={{ width, height: width * 1.3, margin: gap / 2 }}
className="bg-red-300 rounded-lg overflow-hidden"
className="bg-SPOT-red/80 rounded-lg overflow-hidden"
>
<MutationLoadingModal
isSubmiting={isLikePending || isCancelLikePending}
Expand All @@ -87,6 +88,9 @@ export default function MySpotBlock({ mySpot, width, gap }: MySpotBlockProps) {
className="flex-1 justify-end bg-black/40"
onPress={handleClick}
>
<View className="items-center">
<SPOTLogo width={120} color="black" />
</View>
<View className="flex-row justify-end items-center">
<TouchableOpacity
className="flex-row items-center p-2"
Expand Down
16 changes: 7 additions & 9 deletions packages/react-native/src/pages/Home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@ export default withSuspense(function Home({ navigation }: HomeScreenProps) {
renderItem={({ item }) => <Card data={item} size={180} />}
/>
</View>
{nearbySpots.length > 0 && (
<View>
<CardSlider
title="내 주변 SPOT!"
data={nearbySpots}
renderItem={({ item }) => <Card data={item} size={180} />}
/>
</View>
)}
<View>
<CardSlider
title="내 주변 SPOT!"
data={nearbySpots}
renderItem={({ item }) => <Card data={item} size={180} />}
/>
</View>
<View>
<CardSlider
title="이 여행지는 어때요?"
Expand Down
Loading