import React from 'react';
import { Icon } from '@iconify/react';
import clsx, { ClassValue } from 'clsx';

const NavItem: React.FC<{
  className?: ClassValue;
}> = React.memo((props) => {
  return (
    <div
      className={clsx(
        'w-10 h-10 hover:rounded-sm bg-gray-300 mb-2 transition-all rounded-1/2 cursor-pointer flex items-center justify-center',
        props.className
      )}
    >
      {props.children}
    </div>
  );
});

export const App: React.FC = React.memo(() => {
  return (
    <div className="flex h-screen w-screen">
      <div className="w-16 bg-gray-900 flex flex-col justify-start items-center pt-4 pb-4 p-1">
        {/* Navbar */}
        <div className="flex-1">
          <NavItem />
          <div className="h-px w-full bg-white mt-4 mb-4"></div>
          <NavItem />
          <NavItem />
          <NavItem />
          <NavItem />
          <NavItem className="bg-green-500">
            <Icon className="text-3xl text-white" icon="mdi-plus" />
          </NavItem>
        </div>
        <div>
          <Icon
            className="text-3xl text-white cursor-pointer"
            icon="mdi-dots-horizontal"
          />
        </div>
      </div>
      <div className="w-56 bg-gray-800">
        {/* Sidebar */}
        <div className="w-full h-10 hover:bg-white bg-opacity-40">目标</div>
      </div>
      <div className="flex-auto bg-gray-700">{/* Main Content */}</div>
    </div>
  );
});
