-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
created register button with no functionality. added it to the page.t…
…sx file and made test cases to ensure it renders and it handles a click event.
- Loading branch information
1 parent
ac236da
commit 101b907
Showing
4 changed files
with
50 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react'; | ||
import { render, fireEvent } from '@testing-library/react'; | ||
import RegisterButton from "../lib/components/register_button"; | ||
|
||
test('it renders a button with the correct text', () => { | ||
const { getByText } = render(<RegisterButton />); | ||
|
||
// Check if the button with the text 'Register' is rendered | ||
const registerButton = getByText('Register'); | ||
expect(registerButton).toBeInTheDocument(); | ||
}); | ||
|
||
test('it handles click event', () => { | ||
const { getByText } = render(<RegisterButton />); | ||
const registerButton = getByText('Register'); | ||
|
||
// Simulate a click event on the button | ||
fireEvent.click(registerButton); | ||
|
||
// Add your assertion for the click event if needed | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,34 @@ | ||
// components/RegisterButton.js | ||
'use client' | ||
import React, { useState } from 'react'; | ||
|
||
import React from 'react'; | ||
type RegisterButtonProps = { | ||
// No props required for this visually matching button | ||
}; | ||
|
||
const RegisterButton: React.FC<RegisterButtonProps> = () => { | ||
const [isLoading, setIsLoading] = useState(false); | ||
|
||
const handleClick = () => { | ||
// No functional logic is required for this visually matching button | ||
}; | ||
|
||
const RegisterButton = () => { | ||
return ( | ||
<button className="register-button"> | ||
Register | ||
<style jsx>{` | ||
.register-button { | ||
background-color: #0070f3; | ||
color: #fff; | ||
padding: 10px 20px; | ||
border: none; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
transition: background-color 0.3s; | ||
} | ||
.register-button:hover { | ||
background-color: #0056b3; | ||
} | ||
`}</style> | ||
</button> | ||
<div className="fixed top-0 right-0 m-4"> | ||
<button | ||
onClick={handleClick} | ||
className={`${ | ||
isLoading ? 'opacity-50 cursor-not-allowed' : 'cursor-pointer' | ||
} bg-blue-500 text-white w-48 h-12 rounded-full flex justify-center items-center font-semibold text-base shadow-sm disabled:opacity-50`} | ||
disabled={isLoading} | ||
> | ||
{isLoading ? 'Registering...' : 'Register'} | ||
</button> | ||
</div> | ||
); | ||
}; | ||
|
||
export default RegisterButton; | ||
|
||
|
||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters