Skip to content

Commit

Permalink
fix deprecated button event for nextui buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
fredrikmonsen committed Jan 9, 2025
1 parent 3297724 commit c9646b3
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/app/[id]/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default function Page({params}: { params: { id: string } }) {
type='button'
className='abort-button-style'
startContent={<FaArrowAltCircleLeft/>}
onClick={() => router.push(`/${params.id}?title=${titleString}`)}
onPress={() => router.push(`/${params.id}?title=${titleString}`)}
>
Tilbake til titteloversikt
</Button>
Expand Down
11 changes: 5 additions & 6 deletions src/app/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import WarningLabel from '@/components/WarningLabel';
import {catalogDateStringToNorwegianDateString} from '@/utils/dateUtils';
import {TitleContactInfo} from '@/models/TitleContactInfo';
import {Form, Formik} from 'formik';
import SuccessModal from '@/components/SuccessModal';
import {Spinner} from '@nextui-org/spinner';
import ReleasePatternForm from '@/components/ReleasePatternForm';
import ContactInformationForm from '@/components/ContactInformationForm';
Expand Down Expand Up @@ -271,7 +270,7 @@ export default function Page({params}: { params: { id: string } }) {
endContent={<FaBoxOpen size={25}/>}
size={'md'}
className="edit-button-style ml-4 [&]:text-medium"
onClick={() => setShowBoxRegistrationModal(true)}>
onPress={() => setShowBoxRegistrationModal(true)}>
Ny eske
</Button>
</div>
Expand Down Expand Up @@ -369,7 +368,7 @@ export default function Page({params}: { params: { id: string } }) {
size="lg"
className="abort-button-style"
endContent={<ImCross size={25}/>}
onClick={() => {
onPress={() => {
resetForm();
setIsEditing(false);
}}
Expand Down Expand Up @@ -403,7 +402,7 @@ export default function Page({params}: { params: { id: string } }) {
size="lg"
className="edit-button-style mt-5"
endContent={<FaEdit size={25}/>}
onClick={() => setIsEditing(true)}
onPress={() => setIsEditing(true)}
>
Rediger
</Button>
Expand Down Expand Up @@ -459,7 +458,7 @@ export default function Page({params}: { params: { id: string } }) {
size={'lg'}
startContent={<FaArrowAltCircleLeft/>}
className="abort-button-style"
onClick={() => router.push('/')}
onPress={() => router.push('/')}
>
Tilbake
</Button>
Expand All @@ -468,7 +467,7 @@ export default function Page({params}: { params: { id: string } }) {
size={'lg'}
className="edit-button-style"
endContent={<FaEdit/>}
onClick={() => router.push(`/${params.id}/create?title=${titleString}`)}
onPress={() => router.push(`/${params.id}/create?title=${titleString}`)}
>
Legg til informasjon
</Button>
Expand Down
4 changes: 2 additions & 2 deletions src/components/BoxRegistrationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const BoxRegistrationModal: FC<BoxRegistrationModalProps> = (props: BoxRegistrat
startContent={<FaArrowAltCircleLeft/>}
size={'lg'}
className="abort-button-style mt-4"
onClick={() => props.closeModal()}>
onPress={() => props.closeModal()}>
Avbryt
</Button>
</div>
Expand All @@ -116,7 +116,7 @@ const BoxRegistrationModal: FC<BoxRegistrationModalProps> = (props: BoxRegistrat
showInfo.sameTitle ? (
<>
Esken er allerede registrert på denne tittelen ({props.titleName}). Ønsker du å laste inn den eksisterende esken?<br/>
<Button className="edit-button-style" onClick={() => {
<Button className="edit-button-style" onPress={() => {
void updateActiveBoxForTitle(props.titleId, existingBox!.id);
props.updateBoxInfo(existingBox!);
props.closeModal();
Expand Down
4 changes: 2 additions & 2 deletions src/components/ConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const ConfirmationModal: FC<ConfirmationModalProps> = ({
type='button'
size='lg'
className='abort-button-style mt-5'
onClick={() => handleExit()}
onPress={() => handleExit()}
>
Avbryt
</Button>
Expand All @@ -80,7 +80,7 @@ const ConfirmationModal: FC<ConfirmationModalProps> = ({
size='lg'
className='save-button-style mt-5'
disabled={isLoading}
onClick={() => {
onPress={() => {
handleConfirm();
}}
endContent={isLoading ? <Spinner size={'sm'}/> : undefined}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ErrorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const ErrorModal: FC<ErrorModalProps> = ({
type='button'
size='lg'
className='abort-button-style mt-5'
onClick={() => handleExit()}
onPress={() => handleExit()}
>
Lukk
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Header() {
<Link
color="foreground"
className="font-bold text-2xl hover:cursor-pointer"
onClick={() => router.push('/')}
onPress={() => router.push('/')}
>
<Image className="mr-2" src="/hugin/hugin.svg" alt="Hugin logo" width={45} height={45}/>
Hugin
Expand Down
2 changes: 1 addition & 1 deletion src/components/InfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const InfoModal: FC<InfoModalProps> = ({
type='button'
size='lg'
className='abort-button-style mt-5'
onClick={() => handleExit()}
onPress={() => handleExit()}
>
Lukk
</Button>
Expand Down
10 changes: 5 additions & 5 deletions src/components/IssueList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ export default function IssueList(props: {title: title; box: box}) {
type="button"
className="edit-button-style"
disabled={isSubmitting}
onClick={() => {
onPress={() => {
insert(0, proposeNewIssue(values.issues));
}}
>
Expand Down Expand Up @@ -306,13 +306,13 @@ export default function IssueList(props: {title: title; box: box}) {
<Button isIconOnly
className='save-button-style mr-1 [&]:text-medium [&]:bg-green-400'
type='button'
onClick={() => updateIssue(issue)}>
onPress={() => updateIssue(issue)}>
<FaSave/>
</Button>
<Button isIconOnly
className='abort-button-style mr-1'
type='button'
onClick={() => stopEditingIssue()}>
onPress={() => stopEditingIssue()}>
<ImCross/>
</Button>
</>
Expand All @@ -323,7 +323,7 @@ export default function IssueList(props: {title: title; box: box}) {
className={isEditingIssue() ? 'opacity-25 mr-0.5' : 'edit-button-style [&]:text-medium mr-0.5'}
type='button'
disabled={isEditingIssue()}
onClick={() => startEditingIssue(index)}
onPress={() => startEditingIssue(index)}
>
<FiEdit/>
</Button>
Expand All @@ -333,7 +333,7 @@ export default function IssueList(props: {title: title; box: box}) {
<Button isIconOnly
type="button"
className='delete-button-style'
onClick={() => {
onPress={() => {
if (!newspaperIsSaved(index, values.issues.length)) {
remove(index);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/components/LogoutButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const LogoutButton = () => {
<Button
className="edit-button-style"
endContent={<FaSignOutAlt size={25} />}
onClick={logout}
onPress={logout}
>
Logg ut
</Button>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SuccessModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const SuccessModal: FC<SuccessModalProps> = ({
type='button'
size='lg'
className="abort-button-style mt-5"
onClick={() => {buttonOnClick && buttonOnClick();}}
onPress={() => {buttonOnClick && buttonOnClick();}}
>
{buttonText}
</Button>
Expand Down

0 comments on commit c9646b3

Please sign in to comment.