コンポーネント サイドバーナビゲーション サイドバーナビゲーションコンポーネント - 農業/農業

サイドバーナビゲーションコンポーネント - 農業/農業

農業/農業のWebサイト用に設計された、複雑でミニマリストのサイドバーナビゲーションコンポーネント。ジュエルトーンの色、完全な応答性、ダークモードのサポート、および農業コンテキストのダッシュボードと管理システムに適した複数のインタラクティブ要素を備えています。

プレビュー

HTMLコード

<div class="flex h-screen bg-gray-100 dark:bg-gray-900 font-sans">

  <!-- Overlay for mobile when sidebar is open -->
  <div class="fixed inset-0 bg-black bg-opacity-50 z-30 lg:hidden hidden" id="sidebar-overlay"></div>

  <!-- Sidebar -->
  <aside class="w-64 bg-gradient-to-br from-emerald-600 to-emerald-800 dark:from-emerald-800 dark:to-emerald-950 text-white p-4 space-y-6 flex flex-col transform -translate-x-full lg:translate-x-0 transition-transform duration-300 ease-in-out z-40 lg:relative" id="sidebar">

    <!-- Sidebar Header / Logo -->
    <div class="flex items-center justify-between pb-4 border-b border-emerald-500 dark:border-emerald-700">
      <a href="#" class="flex items-center space-x-2 text-2xl font-bold tracking-wider text-white">
        <svg class="w-8 h-8" 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="M9.663 17h4.673M12 3v14m-7 0h14a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2z"></path>
        </svg>
        <span>FarmFlow</span>
      </a>
      <button id="close-sidebar" class="lg: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="M6 18L18 6M6 6l12 12"></path>
        </svg>
      </button>
    </div>

    <!-- Navigation Links -->
    <nav class="flex-1 space-y-2">
      <a href="#dashboard" class="flex items-center space-x-3 p-3 rounded-lg text-emerald-100 hover:bg-emerald-700 dark:hover:bg-emerald-900 transition duration-200 group active:bg-emerald-700 dark:active:bg-emerald-900">
        <svg class="w-6 h-6 text-emerald-200 group-hover:text-white transition duration-200" 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="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m0 0l7 7m-7-7v10a1 1 0 01-1 1h-3m-6 0v-9a1 1 0 00-1-1H9a1 1 0 00-1 1v9m-6 0h6m6 0h6"></path>
        </svg>
        <span class="font-medium">Dashboard</span>
      </a>

      <a href="#fields" class="flex items-center space-x-3 p-3 rounded-lg text-emerald-100 hover:bg-emerald-700 dark:hover:bg-emerald-900 transition duration-200 group">
        <svg class="w-6 h-6 text-emerald-200 group-hover:text-white transition duration-200" 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="M17 14v6m-3-3h6m-10 0H4M7 10h10M4 7h16.71M4 20h16.71M6 14v6m-3-3h6"></path>
        </svg>
        <span class="font-medium">Fields & Crops</span>
      </a>

      <div x-data="{ open: false }" class="relative">
        <button @click="open = !open" class="flex items-center justify-between w-full p-3 rounded-lg text-emerald-100 hover:bg-emerald-700 dark:hover:bg-emerald-900 transition duration-200 group focus:outline-none">
          <div class="flex items-center space-x-3">
            <svg class="w-6 h-6 text-emerald-200 group-hover:text-white transition duration-200" 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="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-3 7h3m-3 4h3m-6-4h.01M9 16h.01"></path>
            </svg>
            <span class="font-medium">Inventory</span>
          </div>
          <svg :class="{ 'rotate-90': open, '': !open }" class="w-4 h-4 transform transition-transform duration-200" 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="M9 5l7 7-7 7"></path>
          </svg>
        </button>
        <div x-show="open" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0 transform scale-y-95" x-transition:enter-end="opacity-100 transform scale-y-100" x-transition:leave="transition ease-in duration-100" x-transition:leave-start="opacity-100 transform scale-y-100" x-transition:leave-end="opacity-0 transform scale-y-95" class="ml-4 mt-1 space-y-1 text-sm" style="display: none;">
          <a href="#seeds" class="flex items-center space-x-2 p-2 rounded-md text-emerald-200 hover:bg-emerald-700 dark:hover:bg-emerald-900 transition duration-200">
            <span class="w-1 h-1 bg-emerald-300 rounded-full"></span>
            <span>Seeds & Fertilizers</span>
          </a>
          <a href="#equipment" class="flex items-center space-x-2 p-2 rounded-md text-emerald-200 hover:bg-emerald-700 dark:hover:bg-emerald-900 transition duration-200">
            <span class="w-1 h-1 bg-emerald-300 rounded-full"></span>
            <span>Equipment</span>
          </a>
        </div>
      </div>
      
      <a href="#weather" class="flex items-center space-x-3 p-3 rounded-lg text-emerald-100 hover:bg-emerald-700 dark:hover:bg-emerald-900 transition duration-200 group">
        <svg class="w-6 h-6 text-emerald-200 group-hover:text-white transition duration-200" 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="M3 15a4 4 0 004 4h9a5 5 0 005-5V7a2 2 0 00-2-2H5a2 2 0 00-2 2v8z"></path>
        </svg>
        <span class="font-medium">Weather Forecast</span>
      </a>

      <a href="#reports" class="flex items-center space-x-3 p-3 rounded-lg text-emerald-100 hover:bg-emerald-700 dark:hover:bg-emerald-900 transition duration-200 group">
        <svg class="w-6 h-6 text-emerald-200 group-hover:text-white transition duration-200" 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="M9 17v-2m3 2v-4m3 2v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"></path>
        </svg>
        <span class="font-medium">Reports & Analytics</span>
      </a>

      <a href="#settings" class="flex items-center space-x-3 p-3 rounded-lg text-emerald-100 hover:bg-emerald-700 dark:hover:bg-emerald-900 transition duration-200 group">
        <svg class="w-6 h-6 text-emerald-200 group-hover:text-white transition duration-200" 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="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"></path>
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path>
        </svg>
        <span class="font-medium">Settings</span>
      </a>
    </nav>

    <!-- User Profile / Footer -->
    <div class="mt-auto pt-6 border-t border-emerald-500 dark:border-emerald-700">
        <div class="flex items-center space-x-3 p-3 rounded-lg hover:bg-emerald-700 dark:hover:bg-emerald-900 transition duration-200">
            <img class="w-10 h-10 rounded-full border-2 border-emerald-300 dark:border-emerald-500" src="https://randomuser.me/api/portraits/men/32.jpg" alt="User Avatar">
            <div class="flex-1">
                <p class="text-white font-semibold">John Wick</p>
                <p class="text-emerald-200 text-sm">Farm Manager</p>
            </div>
            <button class="text-emerald-200 hover:text-white focus:outline-none">
                <svg class="w-5 h-5" 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="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path>
                </svg>
            </button>
        </div>
    </div>

  </aside>

  <!-- Main Content Area (example) -->
  <main class="flex-1 p-6 md:p-8 overflow-y-auto">
    <div class="flex justify-between items-center mb-6">
      <h1 class="text-3xl font-bold text-gray-800 dark:text-white">Dashboard Overview</h1>
      <button id="open-sidebar" class="lg:hidden text-gray-600 dark:text-gray-300 focus:outline-none">
        <svg class="w-8 h-8" 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>

    <!-- Content Grid Example -->
    <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
      <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
        <h2 class="text-xl font-semibold text-gray-700 dark:text-gray-200 mb-4">Field Status</h2>
        <p class="text-gray-600 dark:text-gray-400">Monitor the health and growth of your crops.</p>
        <img src="https://picsum.photos/400/250?random=1" alt="Field" class="mt-4 rounded-md">
      </div>
      <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
        <h2 class="text-xl font-semibold text-gray-700 dark:text-gray-200 mb-4">Upcoming Tasks</h2>
        <ul class="list-disc list-inside text-gray-600 dark:text-gray-400">
          <li>Harvest corn - Oct 25</li>
          <li>Fertilize wheat - Oct 28</li>
          <li>Pest control - Nov 01</li>
        </ul>
      </div>
      <div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
        <h2 class="text-xl font-semibold text-gray-700 dark:text-gray-200 mb-4">Weather Alert</h2>
        <p class="text-gray-600 dark:text-gray-400">Heavy rainfall expected tomorrow. Prepare irrigation systems.</p>
        <img src="https://picsum.photos/400/250?random=2" alt="Weather" class="mt-4 rounded-md">
      </div>
    </div>
  </main>

</div>

<!-- Alpine.js for dropdowns and sidebar toggle -->
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>

<script>
  document.addEventListener('DOMContentLoaded', () => {
    const sidebar = document.getElementById('sidebar');
    const openSidebarBtn = document.getElementById('open-sidebar');
    const closeSidebarBtn = document.getElementById('close-sidebar');
    const sidebarOverlay = document.getElementById('sidebar-overlay');

    function toggleSidebar() {
      sidebar.classList.toggle('-translate-x-full');
      sidebarOverlay.classList.toggle('hidden');
    }

    openSidebarBtn.addEventListener('click', toggleSidebar);
    closeSidebarBtn.addEventListener('click', toggleSidebar);
    sidebarOverlay.addEventListener('click', toggleSidebar);

    // Dark mode toggle (basic example, typically managed by a separate script/local storage)
    // For demonstration, you can manually toggle 'dark' class on the html tag for testing
    // Add a button in your main content or header to toggle this class if needed.
  });

  // To make dark mode persistent, you'd typically add a JS snippet like this:
  // if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
  //   document.documentElement.classList.add('dark')
  // } else {
  //   document.documentElement.classList.remove('dark')
  // }
  // // Whenever the user explicitly chooses light mode
  // localStorage.theme = 'light'
  // // Whenever the user explicitly chooses dark mode
  // localStorage.theme = 'dark'
  // // Whenever the user explicitly chooses to respect the OS preference
  // localStorage.removeItem('theme')
</script>

関連コンポーネント

サイドバーナビゲーションコンポーネント

ダッシュボード用に設計されたシンプルでレスポンシブなサイドバーナビゲーションコンポーネントで、魅力的なアニメーションと素朴な配色が特徴です。ダークモードをサポートしています。

開ける

サイドバーナビゲーションコンポーネント - ゲーム

ゲームWebサイト向けに設計された、黒、白、明るいアクセントカラーのミニマリストでレスポンシブなサイドバーナビゲーションコンポーネント。ダークモードのサポートが含まれています。

開ける

サイドバーナビゲーションコンポーネント

インダストリアルデザインスタイル、温かみのあるニュートラルカラースキーム、ダークモードのサポートを備えたシンプルでレスポンシブなサイドバーナビゲーションコンポーネントで、暗号通貨/ブロックチェーンアプリケーションに適しています。

開ける