社交媒体导航组件
一个适用于社交媒体应用程序的简单响应式导航组件,具有深色主题和受 Material Design 启发的互补配色方案。它包括 logo、导航链接和用户头像。
HTML 代码
<nav class="bg-blue-500 dark:bg-blue-900 p-4 shadow-md">
<div class="container mx-auto flex items-center justify-between">
<!-- Logo -->
<a href="#" class="text-white text-2xl font-bold">SocialLink</a>
<!-- Navigation Links -->
<div class="hidden md:flex space-x-6">
<a href="#" class="text-white hover:text-yellow-200 transition duration-300">Home</a>
<a href="#" class="text-white hover:text-yellow-200 transition duration-300">Notifications</a>
<a href="#" class="text-white hover:text-yellow-200 transition duration-300">Messages</a>
<a href="#" class="text-white hover:text-yellow-200 transition duration-300">Profile</a>
</div>
<!-- User Avatar -->
<div class="flex items-center space-x-4">
<img src="https://randomuser.me/api/portraits/men/32.jpg" alt="User Avatar" class="w-10 h-10 rounded-full border-2 border-white">
<!-- Mobile Menu Button (Hamburger) -->
<button class="md:hidden text-white focus:outline-none">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
</button>
</div>
</div>
<!-- Mobile Navigation (Hidden by default) -->
<div class="md:hidden mt-4 space-y-2">
<a href="#" class="block text-white hover:text-yellow-200 transition duration-300 px-4 py-2">Home</a>
<a href="#" class="block text-white hover:text-yellow-200 transition duration-300 px-4 py-2">Notifications</a>
<a href="#" class="block text-white hover:text-yellow-200 transition duration-300 px-4 py-2">Messages</a>
<a href="#" class="block text-white hover:text-yellow-200 transition duration-300 px-4 py-2">Profile</a>
</div>
</nav>