-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add button and link as button component
- Loading branch information
1 parent
7115372
commit 68d84f1
Showing
4 changed files
with
22 additions
and
2 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
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,12 @@ | ||
import React from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
function LinkAsButton({textToDisplay, classes, pathToRedicrect}) { | ||
return ( | ||
<Link className={classes} to={pathToRedicrect}> | ||
{textToDisplay} | ||
</Link> | ||
) | ||
} | ||
|
||
export default LinkAsButton |
Empty file.
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,8 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import LinkAsButton from '.'; | ||
|
||
test('renders learn react link', () => { | ||
render(<LinkAsButton />); | ||
const linkElement = screen.getByText(/learn react/i); | ||
expect(linkElement).toBeInTheDocument(); | ||
}); |