Skip to content

Commit b63ed41

Browse files
committed
update the LinkedButton proptypes and story
1 parent 3ce7ec9 commit b63ed41

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/components/NextLink/NextLink.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const NextLinkWrapper = React.forwardRef(({ addClass, text, href }, ref) => (
2121
NextLink.propTypes = {
2222
text: PropTypes.string.isRequired,
2323
addClass: PropTypes.string,
24-
path: PropTypes.shape({
24+
path: PropTypes.exact({
2525
pathname: PropTypes.string.isRequired,
2626
query: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
2727
}).isRequired,

src/compounds/LinkedButton/LinkedButton.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import './linked-button.css'
1010
// TODO(alishaevn):
1111
// - use this component in Item.jsx instead, but make sure it maintains its current styling
1212

13-
// NOTE(alishaevn): we are not using the "as" prop in the Link because it removes the ability to access the path query
13+
// we are not using the "as" prop in the Link because it removes the ability to access the path query
1414
const LinkedButton = ({ addClass, buttonProps, path }) => (
1515
<Link href={path} passHref>
1616
<ButtonLinkWrapper
@@ -31,9 +31,9 @@ const { onClick, ...remainingPropTypes } = Button.propTypes
3131
LinkedButton.propTypes = {
3232
buttonProps: PropTypes.shape(remainingPropTypes).isRequired,
3333
addClass: PropTypes.string,
34-
path: PropTypes.shape({
34+
path: PropTypes.exact({
3535
pathname: PropTypes.string.isRequired,
36-
query: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
36+
query: PropTypes.shape({ id: PropTypes.number }),
3737
}).isRequired,
3838
}
3939

src/compounds/LinkedButton/LinkedButton.stories.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ Default.args = {
1818
label: 'Linked Button',
1919
},
2020
addClass: '',
21-
path: '/',
21+
path: {
22+
pathname: '/',
23+
query: {},
24+
},
2225
}
2326

2427
export const WithQuery = Template.bind({})
@@ -30,6 +33,6 @@ WithQuery.args = {
3033
addClass: '',
3134
path: {
3235
pathname: '/test',
33-
query: { name: 'Best Service Ever' },
36+
query: { id: 123 },
3437
},
3538
}

0 commit comments

Comments
 (0)