Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

responsive design with css, html y js

Matias• 330

@mmc1999

Desktop design screenshot for the URL shortening API landing page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
  • API
3intermediate
View challenge

Design comparison


SolutionDesign

Solution retrospective


I have two problems that I cannot solve, please, I need recommendations:

  1. The first is that I have to click twice on the "shorten it" button for the short link to appear.
  2. The second is that I don't know how to change the background color of the network icons, I can only give them opacity. Thank you!

Community feedback

Nguyen Duy• 245

@koalalikecode

Posted

Hey, great work on this challenge!

  • I think you can use the icon on 'fontawesome' for network icons that you mentioned instead of images, then css the color of their hover state
  • Moreover, I don't think you shorten links work well enough because I have to click on the button twice for the result, you can consult my code https://www.frontendmentor.io/solutions/shortly-url-shortening-api-challenge
  • And you should use your h tag respectively, such as h1>h2>...

Aside from that, great work!

0
Mike Hayden• 1,005

@mickyginger

Posted

Hi Matias! 👋

The reason you have to click the "shorted it" button twice, is because if there is no enlaces array in localStorage you skip adding the URL to the DOM:

const mostrarDatos = () => {
    enlaces = JSON.parse(localStorage.getItem("enlaces"));

    if(enlaces === null){
        enlaces = [];
        // then do nothing...
    } else {
       // add the URL to the DOM
    }
}

How about this:

const mostrarDatos = () => {
    // if `enlaces` does not exist in localStorage parse "[]"
   // which will set `enlaces` to an empty array
    enlaces = JSON.parse(localStorage.getItem("enlaces") || '[]'); 

    if(enlaces.length > 0) {
        $sectionBorrar.style.display = "block";
    } 

    $insertarEnlace.innerHTML = "";

    enlaces.forEach(el => {
        $insertarEnlace.innerHTML+=`
            <div class="divAgregado">
                <p class="enlaceOriginal">${el.enlaceOriginal}</p>
                <div class="divAdentroGenerado">
                    <p class="enlaceOriginal enlacecorto">${el.enlaceCorto}</p>
                    <button class="botonParaCopiar">copy</button>
                </div>
            </div>`;
    })
}

I'm not sure what you mean by "network icons" but you can change SVGs by opening the file and modifying the code. If you let me know which icons you want to change the background image of I'll be happy to take another look.

Hope that helps!

0

Matias• 330

@mmc1999

Posted

@mickyginger hi mike, thanks for taking the time to reply. I corrected the error as you told me, but even so I still have to press the button twice for it to work.

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord