Skip to content
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

Fix: display images on CarCard components correctly #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

novacat25
Copy link

@novacat25 novacat25 commented Mar 21, 2024

Description

  • to resolve a problem about displaying images on CarCard

Problem

  • Images of CarCard.tsx are not be displayed correctly

broken_Images

Cause

  • Images from cdn.imagin.studio API were not displayed well, when there were 'angle' params and those values were 'undefined'
  • the method of append() returns 'undefined' when there is no value
    (https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams/append)
  • From CarCard.tsx
    <Image src={generateCarImageUrl(car)} alt='car model' fill priority className='object-contain' />

(Before deleting angle=undefined)
undefined_angle

(After deleting angle=undefined)
detach_undefined_angle

Todo

  • to append angle parameter only when it exists

Result

result

I don't think if this is the best way to resolve this problem, but I wanted to share it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant