More color adjustments

This commit is contained in:
Dane Everitt 2022-02-26 21:26:53 -05:00
parent ff460805c0
commit ae522f1585
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
7 changed files with 66 additions and 24 deletions

View file

@ -4,11 +4,12 @@ import { User } from '@/api/admin/user';
import { AdminTransformers } from '@/api/admin/transformers'; import { AdminTransformers } from '@/api/admin/transformers';
import { Dropdown } from '@/components/elements/dropdown'; import { Dropdown } from '@/components/elements/dropdown';
import { import {
BanIcon,
DotsVerticalIcon, DotsVerticalIcon,
LockClosedIcon, LockOpenIcon,
PaperAirplaneIcon,
PencilIcon, PencilIcon,
PlusIcon, PlusIcon,
SupportIcon,
TrashIcon, TrashIcon,
} from '@heroicons/react/solid'; } from '@heroicons/react/solid';
import { Button } from '@/components/elements/button/index'; import { Button } from '@/components/elements/button/index';
@ -42,7 +43,11 @@ const UsersContainerV2 = () => {
<Dialog.Icon type={'danger'}/> <Dialog.Icon type={'danger'}/>
This account will be permanently deleted. This account will be permanently deleted.
<Dialog.Buttons> <Dialog.Buttons>
<Button.Text className={'!ring-offset-neutral-800'} onClick={() => setVisible(false)}>Cancel</Button.Text> <Button.Text
className={'!ring-offset-neutral-800'}
onClick={() => setVisible(false)}
>Cancel
</Button.Text>
<Button.Danger className={'!ring-offset-neutral-800'}>Delete</Button.Danger> <Button.Danger className={'!ring-offset-neutral-800'}>Delete</Button.Danger>
</Dialog.Buttons> </Dialog.Buttons>
</Dialog> </Dialog>
@ -52,6 +57,7 @@ const UsersContainerV2 = () => {
<th scope={'col'} className={'w-8'}/> <th scope={'col'} className={'w-8'}/>
<th scope={'col'} className={'text-left px-6 py-2 w-full'}>Email</th> <th scope={'col'} className={'text-left px-6 py-2 w-full'}>Email</th>
<th scope={'col'}/> <th scope={'col'}/>
<th scope={'col'}/>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -59,7 +65,7 @@ const UsersContainerV2 = () => {
<tr key={user.uuid}> <tr key={user.uuid}>
<td className={'whitespace-nowrap'}> <td className={'whitespace-nowrap'}>
<div className={'flex justify-end items-center w-8'}> <div className={'flex justify-end items-center w-8'}>
<Checkbox /> <Checkbox/>
</div> </div>
</td> </td>
<td className={'pl-6 py-4 whitespace-nowrap'}> <td className={'pl-6 py-4 whitespace-nowrap'}>
@ -81,16 +87,28 @@ const UsersContainerV2 = () => {
</div> </div>
</div> </div>
</td> </td>
<td className={'pl-2 py-4 whitespace-nowrap'}>
{user.isUsingTwoFactor &&
<span className={'bg-green-100 uppercase text-green-600 font-semibold text-xs px-2 py-0.5 rounded'}>
2-FA Enabled
</span>
}
</td>
<td className={'px-6 py-4 whitespace-nowrap'}> <td className={'px-6 py-4 whitespace-nowrap'}>
<Dropdown> <Dropdown>
<Dropdown.Button className={'px-2'}> <Dropdown.Button className={'px-2'}>
<DotsVerticalIcon/> <DotsVerticalIcon/>
</Dropdown.Button> </Dropdown.Button>
<Dropdown.Item icon={<PencilIcon/>}>Edit</Dropdown.Item> <Dropdown.Item icon={<PencilIcon/>}>Edit</Dropdown.Item>
<Dropdown.Item icon={<PaperAirplaneIcon/>}>Reset Password</Dropdown.Item> <Dropdown.Item icon={<SupportIcon/>}>Reset Password</Dropdown.Item>
<Dropdown.Item icon={<LockClosedIcon/>}>Suspend</Dropdown.Item> <Dropdown.Item icon={<LockOpenIcon/>} disabled={!user.isUsingTwoFactor}>
Disable 2-FA
</Dropdown.Item>
<Dropdown.Item icon={<BanIcon/>}>Suspend</Dropdown.Item>
<Dropdown.Gap/> <Dropdown.Gap/>
<Dropdown.Item icon={<TrashIcon/>} onClick={() => setVisible(true)} danger>Delete Account</Dropdown.Item> <Dropdown.Item icon={<TrashIcon/>} onClick={() => setVisible(true)} danger>Delete
Account
</Dropdown.Item>
</Dropdown> </Dropdown>
</td> </td>
</tr> </tr>

View file

@ -22,7 +22,7 @@
} }
.text { .text {
@apply bg-transparent focus:ring-neutral-300 focus:ring-opacity-50 hover:bg-neutral-600 active:bg-neutral-500; @apply bg-transparent focus:ring-neutral-300 focus:ring-opacity-50 hover:bg-neutral-500 active:bg-neutral-500;
} }
.danger { .danger {

View file

@ -78,12 +78,12 @@ const Dialog = ({ visible, title, onDismissed, children }: Props) => {
leaveFrom={'opacity-100 scale-100'} leaveFrom={'opacity-100 scale-100'}
leaveTo={'opacity-0 scale-95'} leaveTo={'opacity-0 scale-95'}
> >
<div className={'relative bg-neutral-700 rounded max-w-xl w-full mx-auto shadow-lg ring-4 ring-neutral-800 ring-opacity-50'}> <div className={styles.container}>
<div className={'flex p-6'}> <div className={'flex p-6'}>
{icon && <div className={'mr-4'}>{icon}</div>} {icon && <div className={'mr-4'}>{icon}</div>}
<div className={'flex-1'}> <div className={'flex-1'}>
{title && {title &&
<HeadlessDialog.Title className={'font-header text-xl font-medium mb-2 text-white pr-4'}> <HeadlessDialog.Title className={styles.title}>
{title} {title}
</HeadlessDialog.Title> </HeadlessDialog.Title>
} }
@ -92,11 +92,7 @@ const Dialog = ({ visible, title, onDismissed, children }: Props) => {
</HeadlessDialog.Description> </HeadlessDialog.Description>
</div> </div>
</div> </div>
{buttons && {buttons && <div className={styles.button_bar}>{buttons}</div>}
<div className={'px-6 py-3 bg-neutral-800 flex items-center justify-end space-x-3 rounded-b'}>
{buttons}
</div>
}
{/* Keep this below the other buttons so that it isn't the default focus if they're present. */} {/* Keep this below the other buttons so that it isn't the default focus if they're present. */}
<div className={'absolute right-0 top-0 m-4'}> <div className={'absolute right-0 top-0 m-4'}>
<Button.Text square small onClick={() => onDismissed()} className={'hover:rotate-90'}> <Button.Text square small onClick={() => onDismissed()} className={'hover:rotate-90'}>

View file

@ -3,5 +3,18 @@
} }
.overlay { .overlay {
@apply fixed inset-0 bg-neutral-900 opacity-75; @apply fixed inset-0 bg-gray-900 opacity-50;
}
.container {
@apply relative bg-gray-600 rounded max-w-xl w-full mx-auto shadow-lg;
@apply ring-4 ring-gray-800 ring-opacity-80;
& .title {
@apply font-header text-xl font-medium mb-2 text-white pr-4;
}
& > .button_bar {
@apply px-6 py-3 bg-gray-700 flex items-center justify-end space-x-3 rounded-b;
}
} }

View file

@ -12,18 +12,28 @@ interface Props {
onClick?: (e: React.MouseEvent) => void; onClick?: (e: React.MouseEvent) => void;
} }
const DropdownItem = forwardRef<HTMLAnchorElement, Props>(({ disabled, danger, className, onClick, children, icon: IconComponent }, ref) => { const DropdownItem = forwardRef<HTMLAnchorElement, Props>(({
disabled,
danger,
className,
onClick,
children,
icon: IconComponent,
}, ref) => {
return ( return (
<Menu.Item disabled={disabled}> <Menu.Item disabled={disabled}>
{(args) => ( {({ disabled, active }) => (
<a <a
ref={ref} ref={ref}
href={'#'} href={'#'}
className={classNames(styles.menu_item, { [styles.danger]: danger }, className)} className={classNames(styles.menu_item, {
[styles.danger]: danger,
[styles.disabled]: disabled,
}, className)}
onClick={onClick} onClick={onClick}
> >
{IconComponent} {IconComponent}
{typeof children === 'function' ? children(args) : children} {typeof children === 'function' ? children({ disabled, active }) : children}
</a> </a>
)} )}
</Menu.Item> </Menu.Item>

View file

@ -34,7 +34,7 @@
@apply w-4 h-4 mr-4 text-neutral-300; @apply w-4 h-4 mr-4 text-neutral-300;
} }
&:hover, &:focus, &:focus-within { &:hover, &:focus {
@apply bg-blue-500 text-blue-50; @apply bg-blue-500 text-blue-50;
& svg { & svg {
@ -43,7 +43,7 @@
} }
&.danger { &.danger {
&:hover, &:focus, &:focus-within { &:hover, &:focus {
@apply bg-red-500 text-red-50; @apply bg-red-500 text-red-50;
& svg { & svg {
@ -51,4 +51,8 @@
} }
} }
} }
&.disabled {
@apply cursor-not-allowed hover:bg-neutral-800 opacity-30 focus:bg-transparent focus:hover:bg-neutral-800;
}
} }

View file

@ -11,9 +11,10 @@ module.exports = {
}, },
colors: { colors: {
black: '#131a20', black: '#131a20',
// Deprecated, prefer the use of "blue" directly here. // Deprecated, prefer "blue"...
primary: colors.blue, primary: colors.blue,
neutral: colors.neutral, // Deprecate, prefer "gray"...
neutral: colors.gray,
cyan: colors.cyan, cyan: colors.cyan,
}, },
fontSize: { fontSize: {