Skip to content

Commit a378f03

Browse files
authored
Merge pull request #138 from scientist-softserv/155-console-errors
155 console errors
2 parents 45cff71 + 54b2532 commit a378f03

File tree

13 files changed

+75
-48
lines changed

13 files changed

+75
-48
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ Use NPM version `v8.19.2` and please do not mix it with Yarn.
2525
npm run storybook # starts the storybook app so that we can view/test the components in a UI
2626
```
2727
- A new browser tab will automatically open to "http://localhost:6006/"
28+
29+
#### Troubleshooting
30+
- If you see the following when starting the app:
31+
- `Error: error:0308010C:digital envelope routines::unsupported`
32+
- set the following env variable in your local shell: `export NODE_OPTIONS=--openssl-legacy-provider`
33+
2834
## Contributing
2935
<!-- State if you are open to contributions and what your requirements are for accepting them.
3036
-->

src/components/Button/Button.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Button = ({ addClass, backgroundColor, size, label, textColor, type, ...pr
1616
</button>
1717
)
1818

19-
Button.propTypes = {
19+
export const buttonPropTypes = {
2020
addClass: PropTypes.string,
2121
backgroundColor: PropTypes.string,
2222
label: PropTypes.string.isRequired,
@@ -26,6 +26,8 @@ Button.propTypes = {
2626
type: PropTypes.string,
2727
}
2828

29+
Button.propTypes = { ...buttonPropTypes }
30+
2931
Button.defaultProps = {
3032
addClass: '',
3133
backgroundColor: '#000000',

src/components/NextLink/NextLink.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ NextLink.propTypes = {
2323
addClass: PropTypes.string,
2424
path: PropTypes.exact({
2525
pathname: PropTypes.string.isRequired,
26-
query: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
26+
query: PropTypes.shape({}),
2727
}).isRequired,
2828
}
2929

src/compounds/Document/Document.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ Document.propTypes = {
101101
lineItems: PropTypes.arrayOf(PropTypes.shape({})).isRequired,
102102
requestIdentifier: PropTypes.string.isRequired,
103103
shippingPrice: PropTypes.string.isRequired,
104-
shipTo: {
104+
shipTo: PropTypes.shape({
105105
organizationName: PropTypes.string,
106106
text: PropTypes.string,
107-
}.isRequired,
108-
shipFrom: {
107+
}).isRequired,
108+
shipFrom: PropTypes.shape({
109109
organizationName: PropTypes.string,
110110
text: PropTypes.string,
111-
}.isRequired,
111+
}).isRequired,
112112
subtotalPrice: PropTypes.string.isRequired,
113113
taxAmount: PropTypes.string.isRequired,
114114
terms: PropTypes.string.isRequired,

src/compounds/Item/CardBody.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
33
import Card from 'react-bootstrap/card'
4-
import Link from '../../components/Link/Link'
54
import NextLink from '../../components/NextLink/NextLink'
65
import LinkedButton from '../LinkedButton/LinkedButton'
76

src/compounds/Item/Item.jsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ const Item = ({ buttonLink, buttonProps, href, isLoading, item, orientation, tit
7373
)
7474
}
7575

76+
export const itemPropTypes = {
77+
description: PropTypes.string,
78+
id: PropTypes.number.isRequired,
79+
img: PropTypes.shape({
80+
src: PropTypes.string.isRequired,
81+
alt: PropTypes.string,
82+
}).isRequired,
83+
name: PropTypes.string.isRequired,
84+
slug: PropTypes.string,
85+
}
86+
7687
Item.propTypes = {
7788
buttonLink: PropTypes.string,
7889
// currently overriding the label on a button from being required in this component,
@@ -88,16 +99,7 @@ Item.propTypes = {
8899
PropTypes.shape({}),
89100
]),
90101
isLoading: PropTypes.bool,
91-
item: PropTypes.shape({
92-
description: PropTypes.string,
93-
id: PropTypes.number.isRequired,
94-
img: PropTypes.shape({
95-
src: PropTypes.string.isRequired,
96-
alt: PropTypes.string,
97-
}).isRequired,
98-
name: PropTypes.string.isRequired,
99-
slug: PropTypes.string,
100-
}),
102+
item: PropTypes.shape(itemPropTypes).isRequired,
101103
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
102104
titleLink: PropTypes.string,
103105
withButtonLink: PropTypes.bool,
@@ -113,9 +115,6 @@ Item.defaultProps = {
113115
buttonProps: LinkedButton.defaultProps,
114116
href: '',
115117
isLoading: false,
116-
item: {
117-
description: '',
118-
},
119118
orientation: 'vertical',
120119
titleLink: '',
121120
withButtonLink: false,

src/compounds/ItemGroup/ItemGroup.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import PropTypes from 'prop-types'
33
import { Col, Row } from 'react-bootstrap'
44
import Title from '../../components/Title/Title'
5-
import Item from '../Item/Item'
5+
import Item, { itemPropTypes } from '../Item/Item'
66
import ItemLoading from '../Item/ItemLoading'
77
import './item-group.scss'
88

@@ -53,10 +53,10 @@ ItemGroup.propTypes = {
5353
label: PropTypes.string,
5454
}),
5555
items: PropTypes.arrayOf(PropTypes.shape({
56-
...Item.propTypes,
56+
...itemPropTypes,
5757
imgProps: PropTypes.shape({}),
5858
style: PropTypes.shape({}),
59-
})).isRequired,
59+
})),
6060
isLoading: PropTypes.bool.isRequired,
6161
orientation: PropTypes.oneOf(['horizontal', 'vertical']),
6262
withButtonLink: PropTypes.bool,

src/compounds/ItemGroup/ItemGroup.stories.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Default.args = {
1515
backgroundColor: '#A9A9A9',
1616
label: 'Request this item',
1717
},
18+
isLoading: false,
1819
items: items.slice(0, 3),
1920
orientation: 'vertical',
2021
}
@@ -25,6 +26,7 @@ Horizontal.args = {
2526
backgroundColor: '#A9A9A9',
2627
label: 'Request this item',
2728
},
29+
isLoading: false,
2830
items: items.slice(0, 3),
2931
orientation: 'horizontal',
3032
}
@@ -37,6 +39,7 @@ isLoading.args = {
3739

3840
export const withTitleLink = Template.bind({})
3941
withTitleLink.args = {
42+
isLoading: false,
4043
items: items.slice(0, 6),
4144
withTitleLink: true,
4245
}
@@ -47,6 +50,7 @@ withButtonLink.args = {
4750
backgroundColor: '#A9A9A9',
4851
label: 'Request this item',
4952
},
53+
isLoading: false,
5054
items: items.slice(0, 6),
5155
withButtonLink: true,
5256
}

src/compounds/LinkedButton/LinkedButton.jsx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import Link from 'next/link'
33
import PropTypes from 'prop-types'
4-
import Button from '../../components/Button/Button'
4+
import Button, { buttonPropTypes } from '../../components/Button/Button'
55
import './linked-button.css'
66

77
/**
@@ -16,18 +16,23 @@ const LinkedButton = ({ addClass, buttonProps, path }) => (
1616
<ButtonLinkWrapper
1717
addClass={addClass}
1818
buttonProps={buttonProps}
19-
href={path}
2019
/>
2120
</Link>
2221
)
2322

24-
const ButtonLinkWrapper = React.forwardRef(({ addClass, buttonProps, href }, ref) => (
25-
<a href={href} ref={ref} className={addClass}>
26-
<Button {...buttonProps} />
27-
</a>
28-
))
23+
const ButtonLinkWrapper = React.forwardRef(({ ...props }, ref) => {
24+
// eslint-disable-next-line react/prop-types
25+
const { addClass, buttonProps, href } = props
26+
27+
return (
28+
<a href={href} ref={ref} className={addClass}>
29+
<Button {...buttonProps} />
30+
</a>
31+
)
32+
})
33+
34+
const { onClick, ...remainingPropTypes } = buttonPropTypes
2935

30-
const { onClick, ...remainingPropTypes } = Button.propTypes
3136
LinkedButton.propTypes = {
3237
buttonProps: PropTypes.shape(remainingPropTypes).isRequired,
3338
addClass: PropTypes.string,
@@ -41,4 +46,15 @@ LinkedButton.defaultProps = {
4146
addClass: '',
4247
}
4348

49+
ButtonLinkWrapper.propTypes = {
50+
addClass: PropTypes.string,
51+
buttonProps: PropTypes.shape(remainingPropTypes).isRequired,
52+
}
53+
54+
ButtonLinkWrapper.defaultProps = {
55+
addClass: '',
56+
}
57+
58+
ButtonLinkWrapper.displayName = 'Button Link Wrapper'
59+
4460
export default LinkedButton

src/compounds/Messages/MessageCardBody.jsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import PropTypes from 'prop-types'
33
import { Card } from 'react-bootstrap'
44
import Link from '../../components/Link/Link'
55

6-
const MessageCardBody = ({ message, isLatestMessage }) => {
6+
const MessageCardBody = ({ message }) => {
77
const { avatar, body, id, name, attachments, timeSince } = message
88
return (
9-
<Card key={id} className={`${isLatestMessage ? '' : 'pb-4'} pt-4 flex-row border-0 border-top`}>
9+
<Card key={id} className='pb-4 pt-4 flex-row border-0 border-top'>
1010
<Card.Img variant='left' src={avatar} className='h-25' />
1111
<Card.Body className='pt-0 pe-0 d-flex flex-column flex-md-row'>
1212
<div>
@@ -52,7 +52,6 @@ MessageCardBody.propTypes = {
5252
}),
5353
),
5454
}).isRequired,
55-
isLatestMessage: PropTypes.bool.isRequired,
5655
}
5756

5857
export default MessageCardBody

0 commit comments

Comments
 (0)