Submitted 3 months ago
Social Links Profile | Dynamic Link Component with JS
@msuryaditriputraR
Design comparison
SolutionDesign
Solution retrospective
What are you most proud of, and what would you do differently next time?
I create link button component using Javascript, So I can create links dynamically, and In the future I want to make a CMS for this app so that we can create links in the User Interface not from code directly
export default function ({ href, icon, text }) {
const a = document.createElement("a");
a.href = href || "#";
a.classList.add("card__link");
a.setAttribute("target", "_blank");
a.setAttribute("rel", "noopener noreferrer");
const i = document.createElement("i");
i.classList.add(icon);
a.append(i, text);
return a;
}
Community feedback
Please log in to post a comment
Log in with GitHubJoin 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