Skip to content

Commit

Permalink
feat: update preview
Browse files Browse the repository at this point in the history
  • Loading branch information
2jun0 committed May 31, 2024
1 parent 11edff6 commit e5982b5
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions static/preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
const formData = new FormData(form);
const moving = formData.get("moving");
const username = formData.get("username");
const width = formData.get("width");
const height = formData.get("height");

if (username !== "") {
preview.classList.remove("hidden");

const svgUrl = `https://gitpokecol.org/pokemons/${username}?face=${moving}`;
const svgUrl = `https://gitpokecol.org/pokemons/${username}?face=${moving}&width=${width}&height=${height}`;
previewImg.src = svgUrl;
previewUrl.textContent = `<a href="https://github.com/2jun0/github-pokemon-collection">
<img src="${svgUrl}" alt="${username}'s GitHub Pokemon Collection"/>
Expand All @@ -61,7 +63,30 @@ <h2>Github Pokemon Collection Preivew</h2>
<input type="radio" id="right" name="moving" value="right" />
<label for="right">Right</label>
</div>
<input type="text" name="username" placeholder="github username" />
<div>
Width:
<input
type="number"
name="width"
placeholder="svg width"
value="300"
min="250"
/>
</div>
<div>
Height:
<input
type="number"
name="height"
placeholder="svg height"
value="250"
min="200"
/>
</div>
<div>
Username:
<input type="text" name="username" placeholder="github username" />
</div>
<button type="submit">Preview</button>
</form>
<div id="preview" class="hidden">
Expand Down

0 comments on commit e5982b5

Please sign in to comment.