Skip to content

Commit 80d0ad2

Browse files
committed
Merge branch 'main' of https://github.com/scientist-softserv/webstore-component-library into 152-remove-add-attachments
2 parents e353d40 + 6ebf285 commit 80d0ad2

File tree

4 files changed

+21
-31
lines changed

4 files changed

+21
-31
lines changed

src/compounds/RequestItem/RequestItem.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import TextBox from '../../components/TextBox/TextBox'
66
import Title from '../../components/Title/Title'
77
import './request-item.scss'
88

9-
const RequestItem = React.forwardRef(({ backgroundColor, index, request }, ref) => {
10-
const { createdAt, description, href, img, title, status, updatedAt } = request
9+
const RequestItem = React.forwardRef(({ backgroundColor, href, index, request }, ref) => {
10+
const { createdAt, description, img, title, status, updatedAt } = request
1111
const { text, textColor } = status
1212
const image = { ...img, height: 70, width: 70 }
1313
const bg = index % 2 === 0 ? `bg-${backgroundColor}` : `bg-${backgroundColor}-1`
@@ -42,7 +42,10 @@ const RequestItem = React.forwardRef(({ backgroundColor, index, request }, ref)
4242
export const requestPropTypes = {
4343
createdAt: PropTypes.string.isRequired,
4444
description: PropTypes.string.isRequired,
45-
href: PropTypes.string.isRequired,
45+
href: PropTypes.exact({
46+
pathname: PropTypes.string.isRequired,
47+
query: PropTypes.shape({}),
48+
}).isRequired,
4649
img: PropTypes.shape(Image.propTypes).isRequired,
4750
status: PropTypes.shape(Badge.propTypes).isRequired,
4851
title: PropTypes.string.isRequired,
Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react'
22
import RequestItem from './RequestItem'
3-
import { defaultImage } from '../../resources/args'
3+
import { requests } from '../../resources/args'
44

55
export default {
66
title: 'Compounds/RequestItem',
@@ -9,36 +9,17 @@ export default {
99

1010
const Template = (args) => <RequestItem {...args} />
1111

12+
// we are manually passing in the "href" value only for story purposes. in an actual use case, the React.forwardRef handles creating the correct "href" value it gets passed from next/link
1213
export const Default = Template.bind({})
1314
Default.args = {
1415
index: 0,
15-
request: {
16-
createdAt: 'September 9, 2022',
17-
description: 'Does the Company offer services related to Flow Cytometry?',
18-
href: '/request/F575C4',
19-
img: defaultImage,
20-
title: 'F575C4: Assay Depot Coffee Mug',
21-
status: {
22-
text: 'Vendor Review',
23-
},
24-
updatedAt: 'September 9, 2022 at 9:21 am',
25-
}
16+
request: requests[0],
17+
href: requests[0].href.pathname,
2618
}
2719

2820
export const Alternate = Template.bind({})
2921
Alternate.args = {
3022
index: 1,
31-
request: {
32-
createdAt: 'September 9, 2022',
33-
description: 'Does the Company offer services related to Flow Cytometry?',
34-
href: '/request/F575C4',
35-
img: defaultImage,
36-
title: 'F575C4: Assay Depot Coffee Mug',
37-
status: {
38-
backgroundColor: '#DEAF17',
39-
text: 'Work In Progress',
40-
textColor: '#FFFFFF',
41-
},
42-
updatedAt: 'November 16, 2022 at 4:45 pm',
43-
}
23+
request: requests[1],
24+
href: requests[1].href.pathname,
4425
}

src/compounds/RequestList/RequestList.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const RequestList = ({ backgroundColor, requests }) => (
1717
or start a new general request by clicking the <b>"Initiate a Request"</b> button above.
1818
</p>
1919
) : (requests.map((req, index) => (
20-
<Link key={req.id} href={`${req.href}`} passHref legacyBehavior>
20+
<Link key={req.uuid} href={req.href} passHref>
2121
<RequestItem request={req} index={index} backgroundColor={backgroundColor} />
2222
</Link>
2323
)))}

src/resources/args.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,10 @@ export const requests = [
219219
{
220220
createdAt: 'September 9, 2022',
221221
description: 'Does the Company offer services related to Flow Cytometry?',
222-
href: '/request/F575C4',
222+
href: {
223+
pathname: '/request/ui18-8ahr-38na-89as',
224+
query: {},
225+
},
223226
id: 1,
224227
img,
225228
status: {
@@ -232,7 +235,10 @@ export const requests = [
232235
createdAt: 'November 15, 2022',
233236
// eslint-disable-next-line max-len
234237
description: 'General Information When do you plan to work with this supplier? Urgently Name of supplier: Alisha Supplier web address: http://scientist.com Is this new supplier onboarding request related to any of the following areas: Research area: In Vivo Contact Information Supplier contact name: Alisha Evans Supplier email a...',
235-
href: '/request/706D8F',
238+
href: {
239+
pathname: '/request/89as-ui18-8ahr-38na',
240+
query: {},
241+
},
236242
id: 2,
237243
img,
238244
status: {

0 commit comments

Comments
 (0)