Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

value is not reset on add #13

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Revert "button disabled"
This reverts commit 67458dc.
caroluxurians committed Apr 4, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit a7eafa4eebef532e9fb77b351ad341b9b8c7f405
4 changes: 1 addition & 3 deletions src/app/components/add-item.tsx
Original file line number Diff line number Diff line change
@@ -29,9 +29,7 @@ export function AddItem({ onAddItem: addItem }: Props) {
onValueChange={handleOnValueChange}
onEnter={handleAdd}
/>
<Button onClick={handleAdd} disabled={value === ''}>
Add item
</Button>
<Button onClick={handleAdd}>Add item</Button>
</div>
);
}
4 changes: 1 addition & 3 deletions src/app/components/button.tsx
Original file line number Diff line number Diff line change
@@ -3,10 +3,9 @@ import React from 'react';
type Props = {
onClick: () => void;
children: React.ReactNode;
disabled: boolean;
};

export const Button = ({ onClick, children, disabled }: Props) => (
export const Button = ({ onClick, children }: Props) => (
<button
onClick={onClick}
data-testid="button"
@@ -16,7 +15,6 @@ export const Button = ({ onClick, children, disabled }: Props) => (
focus:ring-offset-0 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring
active:bg-destructive/80
disabled:opacity-50"
disabled={disabled}
>
{children}
</button>