Skip to content

Commit

Permalink
refactor: update AdvanceSettings component to get the form register f…
Browse files Browse the repository at this point in the history
…rom useFormContext
  • Loading branch information
Ralph committed Aug 8, 2024
1 parent 4a73cae commit e3735a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import React from 'react';
import { useFormContext } from 'react-hook-form';
import { Link } from 'web-marketplace/src/components/atoms';

import { TextButton } from 'web-components/src/components/buttons/TextButton';
import CheckboxLabel from 'web-components/src/components/inputs/new/CheckboxLabel/CheckboxLabel';

import { ChooseCreditsFormSchemaType } from './ChooseCreditsForm.schema';

export function AdvanceSettings({
advanceSettingsOpen,
toggleAdvancedSettings,
creditVintages,
register,
handleCreditVintageOptions,
}: {
advanceSettingsOpen: boolean;
toggleAdvancedSettings: (e: React.MouseEvent<HTMLElement>) => void;
creditVintages: { date: string; credits: string; batchDenom: string }[];
register: any;
handleCreditVintageOptions: (e: React.ChangeEvent<HTMLInputElement>) => void;
}) {
const { register } = useFormContext<ChooseCreditsFormSchemaType>();
return (
<div className="grid grid-rows-1 mt-20 sm:mt-40">
<div className="flex flex-col">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export function ChooseCreditsForm({
creditVintages={creditVintages}
advanceSettingsOpen={advanceSettingsOpen}
toggleAdvancedSettings={toggleAdvancedSettings}
register={form.register}
handleCreditVintageOptions={handleCreditVintageOptions}
/>
</Form>
Expand Down

0 comments on commit e3735a9

Please sign in to comment.