From b076ae28753097ee3830dc6d85528fdee89083f6 Mon Sep 17 00:00:00 2001 From: Austin Chen Date: Thu, 17 Mar 2022 09:44:41 -0700 Subject: [PATCH] Copy in nav from TailwindUI --- web/components/nav/side-nav-bar.tsx | 364 ++++++++++++++++++++++++++++ web/components/page.tsx | 11 +- 2 files changed, 373 insertions(+), 2 deletions(-) create mode 100644 web/components/nav/side-nav-bar.tsx diff --git a/web/components/nav/side-nav-bar.tsx b/web/components/nav/side-nav-bar.tsx new file mode 100644 index 00000000..9f2c0a0d --- /dev/null +++ b/web/components/nav/side-nav-bar.tsx @@ -0,0 +1,364 @@ +import { Fragment } from 'react' +import { Menu, Popover, Transition } from '@headlessui/react' +import { + ChatAltIcon, + CodeIcon, + DotsVerticalIcon, + EyeIcon, + FlagIcon, + PlusSmIcon, + SearchIcon, + ShareIcon, + StarIcon, + ThumbUpIcon, +} from '@heroicons/react/solid' +import { + BellIcon, + FireIcon, + HomeIcon, + MenuIcon, + TrendingUpIcon, + UserGroupIcon, + XIcon, +} from '@heroicons/react/outline' +import clsx from 'clsx' + +const user = { + name: 'Chelsea Hagon', + email: 'chelsea.hagon@example.com', + imageUrl: + 'https://images.unsplash.com/photo-1550525811-e5869dd03032?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', +} +const navigation = [ + { name: 'Home', href: '#', icon: HomeIcon, current: true }, + { name: 'Popular', href: '#', icon: FireIcon, current: false }, + { name: 'Communities', href: '#', icon: UserGroupIcon, current: false }, + { name: 'Trending', href: '#', icon: TrendingUpIcon, current: false }, +] +const userNavigation = [ + { name: 'Your Profile', href: '#' }, + { name: 'Settings', href: '#' }, + { name: 'Sign out', href: '#' }, +] +const communities = [ + { name: 'Movies', href: '#' }, + { name: 'Food', href: '#' }, + { name: 'Sports', href: '#' }, + { name: 'Animals', href: '#' }, + { name: 'Science', href: '#' }, + { name: 'Dinosaurs', href: '#' }, + { name: 'Talents', href: '#' }, + { name: 'Gaming', href: '#' }, +] +const tabs = [ + { name: 'Recent', href: '#', current: true }, + { name: 'Most Liked', href: '#', current: false }, + { name: 'Most Answers', href: '#', current: false }, +] +const questions = [ + { + id: '81614', + likes: '29', + replies: '11', + views: '2.7k', + author: { + name: 'Dries Vincent', + imageUrl: + 'https://images.unsplash.com/photo-1506794778202-cad84cf45f1d?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', + href: '#', + }, + date: 'December 9 at 11:43 AM', + datetime: '2020-12-09T11:43:00', + href: '#', + title: 'What would you have done differently if you ran Jurassic Park?', + body: ` +

Jurassic Park was an incredible idea and a magnificent feat of engineering, but poor protocols and a disregard for human safety killed what could have otherwise been one of the best businesses of our generation.

+

Ultimately, I think that if you wanted to run the park successfully and keep visitors safe, the most important thing to prioritize would be…

+ `, + }, + // More questions... +] +const whoToFollow = [ + { + name: 'Leonard Krasner', + handle: 'leonardkrasner', + href: '#', + imageUrl: + 'https://images.unsplash.com/photo-1519345182560-3f2917c472ef?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', + }, + // More people... +] +const trendingPosts = [ + { + id: 1, + user: { + name: 'Floyd Miles', + imageUrl: + 'https://images.unsplash.com/photo-1463453091185-61582044d556?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80', + }, + body: 'What books do you have on your bookshelf just to look smarter than you actually are?', + comments: 291, + }, + // More posts... +] + +// Note: this is mostly useful for the mobile sidebar +export default function SideNavBar() { + /* When the mobile menu is open, add `overflow-hidden` to the `body` element to prevent double scrollbars */ + return ( + + clsx( + open ? 'fixed inset-0 z-40 overflow-y-auto' : '', + 'bg-white shadow-sm lg:static lg:overflow-y-visible' + ) + } + > + {({ open }) => ( + <> +
+
+
+
+ + Workflow + +
+
+
+
+
+ +
+
+
+ +
+
+
+
+
+ {/* Mobile menu button */} + + Open menu + {open ? ( + +
+
+ + Go Premium + + + View notifications + + + {/* Profile dropdown */} + +
+ + Open user menu + + +
+ + + {userNavigation.map((item) => ( + + {({ active }) => ( + + {item.name} + + )} + + ))} + + +
+ + + New Post + +
+
+
+ + +
+ {navigation.map((item) => ( + + {item.name} + + ))} +
+
+
+
+ +
+
+
+ {user.name} +
+
+ {user.email} +
+
+ +
+
+ {userNavigation.map((item) => ( + + {item.name} + + ))} +
+
+ +
+ + New Post + + +
+ + Go Premium + +
+
+
+ + )} +
+ ) +} + +export function Sidebar() { + return ( + + ) +} diff --git a/web/components/page.tsx b/web/components/page.tsx index 95ff4270..6657e758 100644 --- a/web/components/page.tsx +++ b/web/components/page.tsx @@ -1,5 +1,6 @@ import clsx from 'clsx' import { NavBar } from './nav/nav-bar' +import SideNavBar, { Sidebar } from './nav/side-nav-bar' export function Page(props: { wide?: boolean @@ -15,12 +16,18 @@ export function Page(props: {
- {children} +
+ +
+
{children}
+
)