Skip to content

Commit

Permalink
ughhhh forwardRef's types SUCK
Browse files Browse the repository at this point in the history
  • Loading branch information
eritbh committed Oct 23, 2024
1 parent 1958a67 commit 777c107
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 17 deletions.
15 changes: 11 additions & 4 deletions extension/data/components/controls/ActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ import {type ComponentPropsWithoutRef, forwardRef} from 'react';
import {classes} from '../../util/ui_interop';
import css from './ActionButton.module.css';

export const ActionButton = forwardRef<HTMLButtonElement>(({
export const ActionButton = forwardRef<
HTMLButtonElement,
ComponentPropsWithoutRef<'button'> & {
inline?: boolean;
}
>(({
inline,
className,
...props
}: ComponentPropsWithoutRef<'button'> & {
inline?: boolean;
}, ref) => (
<button
className={classes(css.actionButton, inline && css.inline, className)}
className={classes(
css.actionButton,
inline && css.inline,
className,
)}
{...props}
ref={ref}
/>
Expand Down
15 changes: 11 additions & 4 deletions extension/data/components/controls/ActionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ import {type ComponentPropsWithoutRef, forwardRef} from 'react';
import {classes} from '../../util/ui_interop';
import css from './ActionSelect.module.css';

export const ActionSelect = forwardRef<HTMLSelectElement>(({
export const ActionSelect = forwardRef<
HTMLSelectElement,
ComponentPropsWithoutRef<'select'> & {
inline?: boolean;
}
>(({
inline,
className,
...props
}: ComponentPropsWithoutRef<'select'> & {
inline?: boolean;
}, ref) => (
<select
className={classes(css.actionSelect, inline && css.inline, className)}
className={classes(
css.actionSelect,
inline && css.inline,
className,
)}
{...props}
ref={ref}
/>
Expand Down
9 changes: 6 additions & 3 deletions extension/data/components/controls/BracketButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import {type ComponentPropsWithoutRef, forwardRef} from 'react';
import {classes} from '../../util/ui_interop';
import css from './BracketButton.module.css';

export const BracketButton = forwardRef<HTMLButtonElement>(({
export const BracketButton = forwardRef<
HTMLButtonElement,
ComponentPropsWithoutRef<'button'> & {
inline?: boolean;
}
>(({
inline,
className,
...props
}: ComponentPropsWithoutRef<'button'> & {
inline?: boolean;
}, ref) => (
<button
className={classes(css.bracketButton, className)}
Expand Down
9 changes: 6 additions & 3 deletions extension/data/components/controls/GeneralButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import {type ComponentPropsWithoutRef, forwardRef} from 'react';
import {classes} from '../../util/ui_interop';
import css from './GeneralButton.module.css';

export const GeneralButton = forwardRef<HTMLButtonElement>(({
export const GeneralButton = forwardRef<
HTMLButtonElement,
ComponentPropsWithoutRef<'button'> & {
inline?: boolean;
}
>(({
inline,
className,
...props
}: ComponentPropsWithoutRef<'button'> & {
inline?: boolean;
}, ref) => (
<button
className={classes(css.generalButton, className)}
Expand Down
9 changes: 6 additions & 3 deletions extension/data/components/controls/NormalInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import {classes} from '../../util/ui_interop';
import css from './NormalInput.module.css';

// TODO: this is a terrible name
export const NormalInput = forwardRef<HTMLInputElement>(({
export const NormalInput = forwardRef<
HTMLInputElement,
ComponentPropsWithoutRef<'input'> & {
inFooter?: boolean;
}
>(({
inFooter,
className,
...props
}: ComponentPropsWithoutRef<'input'> & {
inFooter?: boolean;
}, ref) => (
<input
className={classes(
Expand Down

0 comments on commit 777c107

Please sign in to comment.