Skip to content

Commit

Permalink
add image placeholders
Browse files Browse the repository at this point in the history
  • Loading branch information
anamontiaga committed Apr 12, 2024
1 parent 3271862 commit 3dfe4ec
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 13 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 25 additions & 12 deletions client/src/containers/projects/detail/panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,36 @@ export default function ProjectDetailPanel() {
<div className="absolute left-0 top-0 w-full">
{data && indicators && (
<div className="relative">
<div className="bg-gradient-image absolute z-10 h-52 w-full rounded-t-[24px] bg-[#2B1A0066]" />
{data.main_image?.data?.attributes?.url ? (
<Image
src={data.main_image?.data?.attributes?.url}
alt="AFOCO"
width={300}
height={300}
className="h-52 w-full rounded-t-[24px] object-cover"
/>
) : (
<div className="h-[208px] w-full rounded-t-[24px] bg-gray-200" />
{data.main_image?.data?.attributes?.url && (
<div>
<div className="bg-gradient-image absolute z-10 h-52 w-full rounded-t-[24px] bg-[#2B1A0066]" />

<Image
src={data.main_image?.data?.attributes?.url}
alt="AFOCO"
width={300}
height={300}
className="h-52 w-full rounded-t-[24px] object-cover"
/>
</div>
)}
{!data.main_image?.data?.attributes?.url && (
<div>
<Image
src={'/images/projects/detail-placeholder.png'}
alt="AFOCO"
width={300}
height={300}
className="h-52 w-full rounded-t-[24px] object-cover"
/>
</div>
)}

<h2
className={cn({
'absolute bottom-6 z-20 mx-6 text-lg font-semibold leading-6 text-white': true,
'text-base': !!data?.name?.length && data?.name?.length > 130,
'text-base': !!data?.name?.length && data?.name?.length > 120,
'text-yellow-900': !data.main_image?.data?.attributes?.url,
})}
>
{data?.name}
Expand Down
3 changes: 2 additions & 1 deletion client/src/containers/projects/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export default function ProjectItem({ data }: { data: ProjectListResponseDataIte
>
<Image
src={
data.attributes?.main_image?.data?.attributes?.url || '/images/projects/placeholder.png'
data.attributes?.main_image?.data?.attributes?.url ||
'/images/projects/item-placeholder.png'
}
alt="Project Image"
width={350}
Expand Down

0 comments on commit 3dfe4ec

Please sign in to comment.