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

Hackinrish/button #20

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

Hackinrish/button #20

wants to merge 5 commits into from

Conversation

hackinrish
Copy link
Collaborator

@hackinrish hackinrish commented Oct 22, 2024

Screenshot 2024-10-21 at 6 43 38 PM
  • Button that takes in a text prop and an onclick functon, function can be modified later for according use
  • Closes Issue Create Button #8

src/app/page.tsx Outdated
@@ -1,8 +1,6 @@
const Home = () => {
return (
<div className="flex h-screen w-screen items-center justify-center">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert this change so it still says hello world


interface ButtonProps {
text: string;
link: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of passing in a link can you pass in an arrow function here. For example it can be handleSubmit: () => void. Then this function should be called when the button component is clicked.


const Button = ({ text, link }: ButtonProps) => {
return (
<div className="rounded-md bg-blue-900 px-8 py-2 font-serif text-[vw] text-white">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a div can we use the button component here. It's better for accessibility and makes more sense in this case.

Copy link
Collaborator

@jnalbert jnalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good just some small edits

return (
<button
className="rounded-md bg-blue-900 px-8 py-2 font-serif text-[vw] text-white"
onClick={() => onClick(text)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onClick={() => onClick(text)}
onClick={onClick}


interface ButtonProps {
text: string;
onClick: (params: string) => void;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the params from this function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants