Skip to content

Commit

Permalink
use forwardRef for all the simple wrapper components just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
eritbh committed Oct 23, 2024
1 parent 39770e4 commit 1958a67
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
9 changes: 5 additions & 4 deletions extension/data/components/controls/ActionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import {type ComponentPropsWithoutRef} from 'react';
import {type ComponentPropsWithoutRef, forwardRef} from 'react';
import {classes} from '../../util/ui_interop';
import css from './ActionButton.module.css';

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

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

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

export const GeneralButton = ({
export const GeneralButton = forwardRef<HTMLButtonElement>(({
inline,
className,
...props
}: ComponentPropsWithoutRef<'button'> & {
inline?: boolean;
}) => (
}, ref) => (
<button
className={classes(css.generalButton, className)}
{...props}
ref={ref}
/>
);
));

0 comments on commit 1958a67

Please sign in to comment.