Skip to content

Commit

Permalink
♻️ Remove loading component and update submit button content ♻️
Browse files Browse the repository at this point in the history
  • Loading branch information
Aszurar committed Jan 17, 2024
1 parent 16908f3 commit 4b1d06e
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/components/Header/NewTransactionForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
} from '../../../dto/transactions'
import { Button } from '../../Button'
import { useTransactions } from '../../../hook/useTransactions'
import { Loading } from '../../Loading'
// import { Loading } from '../../Loading'

const newTransactionFormValidation = zod.object({
description: zod.string().min(3, 'É necessário uma descrição válida!'),
Expand Down Expand Up @@ -60,7 +60,7 @@ type NewTransactionFormProps = {
export function NewTransactionForm({
onCloseModal,
}: Readonly<NewTransactionFormProps>) {
const { handleAddNewTransaction, isAddTransactionLoading } = useTransactions()
const { handleAddNewTransaction } = useTransactions()

const {
register,
Expand Down Expand Up @@ -133,14 +133,15 @@ export function NewTransactionForm({
onCloseModal()
}

const submitButtonContent = isAddTransactionLoading ? (
<Loading
className={`border-white border-top-4-register
dark:border-zinc-900 dark:border-top-4-register`}
/>
) : (
'Cadastrar'
)
// This branch will not use json-server, but localStorage so don't need this
// const submitButtonContent = isAddTransactionLoading ? (
// <Loading
// className={`border-white border-top-4-register
// dark:border-zinc-900 dark:border-top-4-register`}
// />
// ) : (
// 'Cadastrar'
// )

return (
<form
Expand Down Expand Up @@ -219,9 +220,9 @@ export function NewTransactionForm({
type="submit"
variant="secondary"
className="w-full"
disabled={isAddTransactionLoading}
// disabled={isAddTransactionLoading}
>
{submitButtonContent}
Cadastrar
</Button>
</form>
)
Expand Down

0 comments on commit 4b1d06e

Please sign in to comment.