Skip to content

Commit e503f87

Browse files
authored
Merge pull request #121 from scientist-softserv/120-service-button
Update service button to have the correct path
2 parents 746bb50 + f900966 commit e503f87

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

src/compounds/ItemPage/ItemPage.jsx

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,49 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
3-
import { Button, Row, Col } from 'react-bootstrap'
3+
import { Row, Col } from 'react-bootstrap'
44
import Image from '../../components/Image/Image'
5+
import LinkedButton from '../LinkedButton/LinkedButton'
56
import TextBox from '../../components/TextBox/TextBox'
67
import Title from '../../components/Title/Title'
78

8-
const ItemPage = ({ title, titleStyle, description, descriptionStyle, img }) => {
9+
const ItemPage = ({ descriptionStyle, img, titleStyle, ware }) => {
10+
const { description, id, name, snippet, slug } = ware
911
// sets a default width while still allowing width to be overridden
10-
img = { width: 400, ...img }
1112

1213
return (
1314
<main className='container py-5'>
14-
<Title title={title} style={titleStyle}/>
15+
<Title title={name} style={titleStyle} />
1516
<Row className='mt-3'>
1617
<Col xs={12} md={6} className='d-flex flex-column'>
17-
<TextBox text={description} style={descriptionStyle} size='medium' />
18-
{/* TODO(summer-cook): Update this button's href so it is pointing at the item's form instead of blank request form */}
19-
<Button href='/requests/new' className='align-self-start mt-4'>Initiate Request</Button>
18+
<TextBox text={description || snippet} style={descriptionStyle} size='medium' />
19+
<LinkedButton
20+
addClass='align-self-start mt-4'
21+
buttonProps={{ label: 'Initiate Request' }}
22+
path={{ pathname: `/requests/new/${slug}`, query: { id } }}
23+
/>
2024
</Col>
2125
<Col xs={12} md={6} className='mt-4 mt-md-0 me-md-auto d-flex justify-content-start justify-content-md-end'>
22-
<Image {...img} />
26+
<Image {...img} addClass='img-fluid' />
2327
</Col>
2428
</Row>
2529
</main>
2630
)
2731
}
2832

2933
ItemPage.propTypes = {
30-
description: PropTypes.string.isRequired,
3134
descriptionStyle: PropTypes.shape({}),
32-
img: Image.defaultProps.isRequired,
33-
title: PropTypes.string.isRequired,
35+
img: PropTypes.shape({
36+
alt: PropTypes.string.isRequired,
37+
src: PropTypes.string.isRequired,
38+
}).isRequired,
3439
titleStyle: PropTypes.shape({}),
40+
ware: PropTypes.shape({
41+
description: PropTypes.string.isRequired,
42+
id: PropTypes.number.isRequired,
43+
slug: PropTypes.string.isRequired,
44+
snippet: PropTypes.string.isRequired,
45+
name: PropTypes.string.isRequired,
46+
}).isRequired,
3547
}
3648

3749
ItemPage.defaultProps = {

src/compounds/ItemPage/ItemPage.stories.jsx

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,36 @@ const Template = (args) => <ItemPage {...args} />
1111

1212
export const Default = Template.bind({})
1313
Default.args = {
14-
description: 'Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci.',
1514
descriptionStyle: {},
1615
img: {
1716
alt: 'test tubes',
1817
src: item,
1918
},
20-
title: 'CRISPR[DEMO]',
2119
titleStyle: {},
20+
ware: {
21+
// eslint-disable-next-line max-len
22+
description: 'Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci.',
23+
id: 4356,
24+
name: 'CRISPR[DEMO]',
25+
slug: 'crispr-demo',
26+
},
2227
}
2328

2429
export const Alternative = Template.bind({})
2530
Alternative.args = {
26-
description: 'Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci. Using advanced CRISPR technology, add or delete base pairs at a specifically targeted DNA loci.',
2731
descriptionStyle: {},
2832
img: {
2933
alt: 'test tubes',
3034
src: item,
3135
width: 650,
3236
},
33-
title: 'CRISPR[DEMO]',
3437
titleStyle: {},
38+
ware: {
39+
description: '',
40+
id: 4356,
41+
name: 'CRISPR[DEMO]',
42+
slug: 'crispr-demo',
43+
// eslint-disable-next-line max-len
44+
snippet: 'this is a snippet. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard text. It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using',
45+
},
3546
}

0 commit comments

Comments
 (0)