Skip to content

Commit

Permalink
feat: add button and link as button component
Browse files Browse the repository at this point in the history
  • Loading branch information
vieraboschkova committed Feb 28, 2021
1 parent 7115372 commit 68d84f1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/src/components/Button/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'

function Button({textToDisplay}) {
function Button({textToDisplay, classes, callback}) {
return (
<button className="button">
<button className={classes} onClick={callback}>
{textToDisplay}
</button>
)
Expand Down
12 changes: 12 additions & 0 deletions client/src/components/LinkAsButton/index.js
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.
8 changes: 8 additions & 0 deletions client/src/components/LinkAsButton/test.js
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();
});

0 comments on commit 68d84f1

Please sign in to comment.