Imran607's picture
can u convert figma design to code? with front-end and backend?
4ccea17 verified
class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
nav {
background: white;
padding: 1rem 2rem;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
position: fixed;
width: 100%;
top: 0;
z-index: 1000;
}
.logo {
font-weight: 800;
font-size: 1.5rem;
background: linear-gradient(to right, #6366f1, #8b5cf6);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.nav-links {
display: flex;
gap: 2rem;
list-style: none;
margin: 0;
padding: 0;
}
.nav-links a {
color: #4b5563;
text-decoration: none;
font-weight: 500;
transition: color 0.2s;
}
.nav-links a:hover {
color: #6366f1;
}
.nav-actions {
display: flex;
gap: 1rem;
align-items: center;
}
.btn-outline {
border: 1px solid #6366f1;
color: #6366f1;
padding: 0.5rem 1.25rem;
border-radius: 0.5rem;
transition: all 0.2s;
}
.btn-outline:hover {
background: #6366f1;
color: white;
}
.btn-solid {
background: linear-gradient(to right, #6366f1, #8b5cf6);
color: white;
padding: 0.5rem 1.25rem;
border-radius: 0.5rem;
transition: all 0.2s;
}
.btn-solid:hover {
opacity: 0.9;
}
.mobile-menu-btn {
display: none;
background: none;
border: none;
color: #4b5563;
cursor: pointer;
}
#mobile-menu {
display: none;
position: absolute;
top: 100%;
left: 0;
right: 0;
background: white;
padding: 1rem;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
#mobile-menu.open {
display: block;
}
@media (max-width: 768px) {
.nav-links, .nav-actions {
display: none;
}
.mobile-menu-btn {
display: block;
}
}
</style>
<nav>
<div>
<a href="/" class="logo">EduSphere</a>
</div>
<ul class="nav-links">
<li><a href="/">Home</a></li>
<li><a href="/courses.html">Courses</a></li>
<li><a href="/about.html">About</a></li>
<li><a href="/contact.html">Contact</a></li>
</ul>
<div class="nav-actions">
<a href="/login.html" class="btn-outline">Log In</a>
<a href="/signup.html" class="btn-solid">Sign Up</a>
</div>
<button class="mobile-menu-btn" onclick="toggleMobileMenu()">
<i data-feather="menu"></i>
</button>
</nav>
<div id="mobile-menu" class="hidden">
<div class="flex flex-col space-y-4 p-4">
<a href="/" class="text-gray-700 hover:text-primary">Home</a>
<a href="/courses.html" class="text-gray-700 hover:text-primary">Courses</a>
<a href="/about.html" class="text-gray-700 hover:text-primary">About</a>
<a href="/contact.html" class="text-gray-700 hover:text-primary">Contact</a>
<div class="pt-4 border-t border-gray-200">
<a href="/login.html" class="block text-center text-gray-700 hover:text-primary mb-3">Log In</a>
<a href="/signup.html" class="block text-center bg-primary text-white py-2 rounded-lg hover:bg-opacity-90">Sign Up</a>
</div>
</div>
</div>
`;
// Replace feather icons after shadow DOM is rendered
setTimeout(() => {
if (this.shadowRoot.querySelector('[data-feather]')) {
feather.replace();
}
}, 100);
}
}
customElements.define('custom-navbar', CustomNavbar);