midudev / kings-league-project

API y website de la Kings League Infojobs por temas didácticos
https://kingsleague.dev
MIT License
1.52k stars 227 forks source link

Feature: Added download svg for player cards #333

Closed whoknowsi closed 1 year ago

whoknowsi commented 1 year ago

I have submitted a pull request that includes a new feature for downloading player card images in SVG format using the html-to-image library. The decision to use SVG format was made to maintain image quality, however, it is also possible to download the images in PNG format (changes on the code), but this may result in a loss of image quality. I apologize for any issues or inconvenience caused by the implementation of this feature. To ensure that the card images would not be cropped when downloaded, I had to take the following steps:

  1. placed the card inside a container
  2. extracted the url
  3. then returned the card back to its original position

By doing this, I was able to download the player card images without any cropping or loss of quality.

This is my first time working with Astro, and I was not entirely familiar with the best practices for adding event listeners. As a result, I used a basic selector by using querySelector and added the listeners that way.

When hover on player card: 1

If button is clicked: 2

Svg saved: 3

felixicaza commented 1 year ago

Amazing!