React 通关秘籍 快速掌握 Tailwind:最流行的原子化 CSS 框架
import React from 'react';
import { Link } from 'react-router-dom';
import siteLogo from '../images/logo.svg';
const Navbar = () => {
return (
<nav className="bg-gray-800">
<div className="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8">
<div className="relative flex items-center justify-between h-16">
<div className="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start">
<div className="flex-shrink-0 flex items-center">
<img
className="block lg:hidden h-8 w-auto"
src={siteLogo}
alt="Workflow"
/>
<img
className="hidden lg:block h-8 w-auto"
src={siteLogo}
alt="Workflow"
/>
</div>
<div className="hidden sm:block sm:ml-6">
<div className="flex space-x-4">
<Link
to="/"
className="bg-gray-900 text-white px-3 py-2 rounded-md text-sm font-medium"
>
Dashboard
</Link>
<Link
to="/settings"
className="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium"
>
Settings
</Link>
</div>
</div>
</div>
<div className="absolute inset-y-0 right-0 flex items-center pr-2 sm:static sm:inset-auto sm:ml-6 sm:pr-0">
<button className="bg-gray-800 p-1 rounded-full text-gray-400 hover:text-white focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-gray-800 focus:ring-white">
<span className="sr-only">View notifications</span>
{/* Tailwind CSS icon */}
<svg
className="h-6 w-6"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
aria-hidden="true"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M15 17h5l-1.40.59.01-2.01A5.9
评论已关闭