Feat/hide unused features

This commit is contained in:
Valentino 2022-02-09 09:03:44 +00:00
parent 8d5d0a666e
commit 41b86d4a6d
28 changed files with 3357 additions and 20314 deletions

View file

@ -0,0 +1,29 @@
import React from 'react';
import { SpeakerphoneIcon } from '@heroicons/react/outline';
type BannerProps = {
title: string;
titleSm: string;
};
const Banner: React.FC<BannerProps> = ({ title, titleSm }) => {
return (
<div className="bg-primary-600 rounded-md">
<div className="max-w-7xl mx-auto py-3 px-3 sm:px-3">
<div className="flex items-center justify-between flex-wrap">
<div className="w-0 flex-1 flex items-center">
<span className="flex p-2 rounded-lg bg-primary-800">
<SpeakerphoneIcon className="h-6 w-6 text-white" aria-hidden="true" />
</span>
<p className="ml-3 font-small text-white truncate">
<span className="md:hidden">{titleSm}</span>
<span className="hidden md:inline">{title}</span>
</p>
</div>
</div>
</div>
</div>
);
};
export default Banner;

View file

@ -0,0 +1 @@
export { default as Banner } from './Banner';

View file

@ -1,12 +1,13 @@
import React, { Fragment } from 'react';
import { Disclosure, Menu, Transition } from '@headlessui/react';
import { MenuIcon, XIcon } from '@heroicons/react/outline';
import { Link, RouteComponentProps } from '@reach/router';
import { useAuth } from 'src/services/auth';
import Gravatar from 'react-gravatar';
import { Link, useLocation } from 'react-router-dom';
import clsx from 'clsx';
const navigation = [
{ name: 'Dashboard', to: '/dashboard' },
{ name: 'Apps', to: '/apps' },
{ name: 'Users', to: '/users' },
];
@ -14,15 +15,18 @@ function classNames(...classes: any[]) {
return classes.filter(Boolean).join(' ');
}
type HeaderProps = RouteComponentProps;
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface HeaderProps {}
const Header: React.FC<HeaderProps> = () => {
const { logOut } = useAuth();
const { pathname } = useLocation();
return (
<Disclosure as="nav" className="bg-white shadow">
<Disclosure as="nav" className="bg-white shadow relative z-10">
{({ open }) => (
<>
<div className="relative">
<div className="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8">
<div className="relative flex justify-between h-16">
<div className="absolute inset-y-0 left-0 flex items-center sm:hidden">
@ -47,16 +51,13 @@ const Header: React.FC<HeaderProps> = () => {
<Link
key={item.name}
to={item.to}
getProps={({ isCurrent }) => {
// the object returned here is passed to the
// anchor element's props
return {
className: isCurrent
? 'border-primary-400 text-gray-900 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium'
: 'border-transparent text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium',
'aria-current': isCurrent ? 'page' : undefined,
};
}}
className={clsx(
'border-primary-50 text-gray-900 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium',
{
'border-primary-500 text-gray-500 hover:border-gray-300 hover:text-gray-700 inline-flex items-center px-1 pt-1 text-sm font-medium':
pathname.includes(item.to),
},
)}
>
{item.name}
</Link>
@ -69,11 +70,9 @@ const Header: React.FC<HeaderProps> = () => {
<div>
<Menu.Button className="bg-white rounded-full flex text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary">
<span className="sr-only">Open user menu</span>
<img
className="h-8 w-8 rounded-full"
src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=facearea&facepad=2&w=256&h=256&q=80"
alt=""
/>
<span className="inline-flex items-center justify-center h-8 w-8 rounded-full bg-gray-500 overflow-hidden">
<Gravatar email="" size={32} rating="pg" protocol="https://" />
</span>
</Menu.Button>
</div>
<Transition
@ -90,7 +89,23 @@ const Header: React.FC<HeaderProps> = () => {
{({ active }) => (
<a
onClick={() => logOut()}
className={classNames(active ? 'bg-gray-100' : '', 'block px-4 py-2 text-sm text-gray-700')}
className={classNames(
active ? 'bg-gray-100 cursor-pointer' : '',
'block px-4 py-2 text-sm text-gray-700 cursor-pointer',
)}
>
Configure profile
</a>
)}
</Menu.Item>
<Menu.Item>
{({ active }) => (
<a
onClick={() => logOut()}
className={classNames(
active ? 'bg-gray-100 cursor-pointer' : '',
'block px-4 py-2 text-sm text-gray-700 cursor-pointer',
)}
>
Sign out
</a>
@ -109,23 +124,23 @@ const Header: React.FC<HeaderProps> = () => {
<Link
key={item.name}
to={item.to}
getProps={({ isCurrent }) => {
// the object returned here is passed to the
// anchor element's props
return {
className: isCurrent
? 'bg-primary-50 border-primary-400 text-primary-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium'
: 'border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium',
'aria-current': isCurrent ? 'page' : undefined,
};
}}
// getProps={({ isCurrent }) => {
// // the object returned here is passed to the
// // anchor element's props
// return {
// className: isCurrent
// ? 'bg-primary-50 border-primary-400 text-primary-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium'
// : 'border-transparent text-gray-500 hover:bg-gray-50 hover:border-gray-300 hover:text-gray-700 block pl-3 pr-4 py-2 border-l-4 text-base font-medium',
// 'aria-current': isCurrent ? 'page' : undefined,
// };
// }}
>
{item.name}
</Link>
))}
</div>
</Disclosure.Panel>
</>
</div>
)}
</Disclosure>
);

View file

@ -1,10 +1,7 @@
import React from 'react';
import { RouteComponentProps } from '@reach/router';
import { Header } from '../Header';
type DashboardProps = RouteComponentProps;
const Layout: React.FC<DashboardProps> = ({ children }) => {
const Layout: React.FC = ({ children }) => {
return (
<>
<Header />

View file

@ -1,5 +1,6 @@
export { Layout } from './Layout';
export { Header } from './Header';
export { Table } from './Table';
export { Banner } from './Banner';
export { Tabs } from './Tabs';
export { Modal, ConfirmationModal } from './Modal';