Fix lint errors

This commit is contained in:
Gregory Schier
2023-02-18 16:30:29 -08:00
parent 92f0ead969
commit 5e55276d79
5 changed files with 50 additions and 46 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
use http::header::{HeaderName, CONTENT_TYPE, USER_AGENT}; use http::header::{HeaderName, USER_AGENT};
use http::{HeaderMap, HeaderValue, Method}; use http::{HeaderMap, HeaderValue, Method};
use reqwest::redirect::Policy; use reqwest::redirect::Policy;
use tauri::{AppHandle, Wry}; use tauri::{AppHandle, Wry};
+1 -1
View File
@@ -6,7 +6,7 @@ import { Input } from './components/Input';
import { Stacks } from './components/Stacks'; import { Stacks } from './components/Stacks';
import { Button } from './components/Button'; import { Button } from './components/Button';
import { Grid } from './components/Grid'; import { Grid } from './components/Grid';
import { Dropdown, DropdownMenuRadio } from './components/Dropdown.tsx'; import { DropdownMenuRadio } from './components/Dropdown';
interface Response { interface Response {
url: string; url: string;
+1 -1
View File
@@ -5,7 +5,7 @@ type Props = ButtonHTMLAttributes<HTMLButtonElement> & {
color?: 'primary' | 'secondary'; color?: 'primary' | 'secondary';
}; };
export const Button = forwardRef(function Button( export const Button = forwardRef<HTMLButtonElement, Props>(function Button(
{ className, color = 'primary', ...props }: Props, { className, color = 'primary', ...props }: Props,
ref, ref,
) { ) {
+46 -42
View File
@@ -8,11 +8,10 @@ import {
HamburgerMenuIcon, HamburgerMenuIcon,
} from '@radix-ui/react-icons'; } from '@radix-ui/react-icons';
import { forwardRef, HTMLAttributes, ReactNode, useState } from 'react'; import { forwardRef, HTMLAttributes, ReactNode, useState } from 'react';
import { Button } from './Button.tsx'; import { Button } from './Button';
import classnames from 'classnames'; import classnames from 'classnames';
import { HotKey } from './HotKey.tsx'; import { HotKey } from './HotKey';
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface DropdownMenuRadioProps { interface DropdownMenuRadioProps {
children: ReactNode; children: ReactNode;
onValueChange: (value: string) => void; onValueChange: (value: string) => void;
@@ -20,7 +19,7 @@ interface DropdownMenuRadioProps {
items: { items: {
label: string; label: string;
value: string; value: string;
}; }[];
} }
export function DropdownMenuRadio({ export function DropdownMenuRadio({
@@ -86,7 +85,7 @@ export function Dropdown() {
<DropdownMenuCheckboxItem <DropdownMenuCheckboxItem
checked={bookmarksChecked} checked={bookmarksChecked}
onCheckedChange={setBookmarksChecked} onCheckedChange={(v) => setBookmarksChecked(!!v)}
rightSlot={<HotKey>B</HotKey>} rightSlot={<HotKey>B</HotKey>}
leftSlot={ leftSlot={
<DropdownMenu.ItemIndicator className="DropdownMenuItemIndicator"> <DropdownMenu.ItemIndicator className="DropdownMenuItemIndicator">
@@ -98,7 +97,7 @@ export function Dropdown() {
</DropdownMenuCheckboxItem> </DropdownMenuCheckboxItem>
<DropdownMenuCheckboxItem <DropdownMenuCheckboxItem
checked={urlsChecked} checked={urlsChecked}
onCheckedChange={setUrlsChecked} onCheckedChange={(v) => setUrlsChecked(!!v)}
leftSlot={ leftSlot={
<DropdownMenu.ItemIndicator className="DropdownMenuItemIndicator"> <DropdownMenu.ItemIndicator className="DropdownMenuItemIndicator">
<CheckIcon /> <CheckIcon />
@@ -125,34 +124,37 @@ export function Dropdown() {
const dropdownMenuClasses = 'bg-background rounded-md shadow-lg p-1.5 border border-gray-100'; const dropdownMenuClasses = 'bg-background rounded-md shadow-lg p-1.5 border border-gray-100';
const DropdownMenuPortal = forwardRef(function DropdownMenuPortal( interface DropdownMenuPortalProps {
{ children }: { children: DropdownMenuContent }, children: ReactNode;
ref, }
) {
function DropdownMenuPortal({ children }: DropdownMenuPortalProps) {
return ( return (
<DropdownMenu.Portal ref={ref} asChild container={document.querySelector('#radix-portal')}> <DropdownMenu.Portal container={document.querySelector<HTMLElement>('#radix-portal')}>
<motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }}> <motion.div initial={{ opacity: 0 }} animate={{ opacity: 1 }}>
{children} {children}
</motion.div> </motion.div>
</DropdownMenu.Portal> </DropdownMenu.Portal>
); );
}); }
const DropdownMenuContent = forwardRef(function DropdownMenuContent( const DropdownMenuContent = forwardRef<HTMLDivElement, DropdownMenu.DropdownMenuContentProps>(
{ className, children, ...props }: DropdownMenu.DropdownMenuContentProps, function DropdownMenuContent(
ref, { className, children, ...props }: DropdownMenu.DropdownMenuContentProps,
) { ref,
return ( ) {
<DropdownMenu.Content return (
ref={ref} <DropdownMenu.Content
align="start" ref={ref}
className={classnames(className, dropdownMenuClasses, 'mt-1')} align="start"
{...props} className={classnames(className, dropdownMenuClasses, 'mt-1')}
> {...props}
{children} >
</DropdownMenu.Content> {children}
); </DropdownMenu.Content>
}); );
},
);
type DropdownMenuItemProps = DropdownMenu.DropdownMenuItemProps & ItemInnerProps; type DropdownMenuItemProps = DropdownMenu.DropdownMenuItemProps & ItemInnerProps;
@@ -232,20 +234,22 @@ function DropdownMenuRadioItem({ rightSlot, children, ...props }: DropdownMenuRa
); );
} }
const DropdownMenuSubContent = forwardRef(function DropdownMenuSubContent( const DropdownMenuSubContent = forwardRef<HTMLDivElement, DropdownMenu.DropdownMenuSubContentProps>(
{ className, ...props }: DropdownMenu.DropdownMenuSubContentProps, function DropdownMenuSubContent(
ref, { className, ...props }: DropdownMenu.DropdownMenuSubContentProps,
) { ref,
return ( ) {
<DropdownMenu.SubContent return (
ref={ref} <DropdownMenu.SubContent
alignOffset={0} ref={ref}
sideOffset={4} alignOffset={0}
className={classnames(className, dropdownMenuClasses)} sideOffset={4}
{...props} className={classnames(className, dropdownMenuClasses)}
/> {...props}
); />
}); );
},
);
function DropdownMenuLabel({ className, children, ...props }: DropdownMenu.DropdownMenuLabelProps) { function DropdownMenuLabel({ className, children, ...props }: DropdownMenu.DropdownMenuLabelProps) {
return ( return (
@@ -283,7 +287,7 @@ interface ItemInnerProps extends HTMLAttributes<HTMLDivElement> {
noHover?: boolean; noHover?: boolean;
} }
const ItemInner = forwardRef(function ItemInner( const ItemInner = forwardRef<HTMLDivElement, ItemInnerProps>(function ItemInner(
{ leftSlot, rightSlot, children, className, noHover, ...props }: ItemInnerProps, { leftSlot, rightSlot, children, className, noHover, ...props }: ItemInnerProps,
ref, ref,
) { ) {
+1 -1
View File
@@ -1,5 +1,5 @@
import classnames from 'classnames'; import classnames from 'classnames';
import { ButtonHTMLAttributes, HTMLAttributes } from 'react'; import {HTMLAttributes} from 'react';
const colsClasses = { const colsClasses = {
none: 'grid-cols-none', none: 'grid-cols-none',