Skip to content

Commit

Permalink
React 19 (#1020)
Browse files Browse the repository at this point in the history
  • Loading branch information
eritbh authored Dec 12, 2024
1 parent 68d35db commit 7a89773
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 195 deletions.
16 changes: 6 additions & 10 deletions extension/data/components/controls/ActionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import {type ComponentPropsWithoutRef, forwardRef} from 'react';
import {type ComponentPropsWithRef} from 'react';
import {classes} from '../../util/ui_interop';
import css from './ActionButton.module.css';

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

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

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

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

// TODO: this is a terrible name
export const NormalInput = forwardRef<
HTMLInputElement,
ComponentPropsWithoutRef<'input'> & {
inFooter?: boolean;
}
>(({
export const NormalInput = ({
inFooter,
className,
...props
}, ref) => (
}: ComponentPropsWithRef<'input'> & {
inFooter?: boolean;
}) => (
<input
className={classes(
css.normalInput,
inFooter && css.inWindowFooter,
className,
)}
{...props}
ref={ref}
/>
));
);
8 changes: 2 additions & 6 deletions extension/data/modules/modnotes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -405,11 +405,7 @@ function ModNotesPopup ({
}

// Handle note creation
async function handleNewNoteSubmit (event) {
// don't actually perform the HTML form action
event.preventDefault();
const formData = new FormData(event.target);

async function submitNewNote (formData) {
try {
await TBApi.createModNote({
user,
Expand Down Expand Up @@ -439,7 +435,7 @@ function ModNotesPopup ({
}, []);

const popupFooter = (
<form className={css.modnoteCreateForm} onSubmit={handleNewNoteSubmit}>
<form className={css.modnoteCreateForm} action={submitNewNote}>
<ActionSelect
name='label'
defaultValue={defaultNoteLabelValueToLabelType[defaultNoteLabel]}
Expand Down
Loading

0 comments on commit 7a89773

Please sign in to comment.