|
1 | 1 | import React from 'react'
|
2 | 2 | import PropTypes from 'prop-types'
|
3 |
| -import { Button, Row, Col } from 'react-bootstrap' |
| 3 | +import { Row, Col } from 'react-bootstrap' |
4 | 4 | import Image from '../../components/Image/Image'
|
| 5 | +import LinkedButton from '../LinkedButton/LinkedButton' |
5 | 6 | import TextBox from '../../components/TextBox/TextBox'
|
6 | 7 | import Title from '../../components/Title/Title'
|
7 | 8 |
|
8 |
| -const ItemPage = ({ title, titleStyle, description, descriptionStyle, img }) => { |
| 9 | +const ItemPage = ({ descriptionStyle, img, titleStyle, ware }) => { |
| 10 | + const { description, id, name, snippet, slug } = ware |
9 | 11 | // sets a default width while still allowing width to be overridden
|
10 |
| - img = { width: 400, ...img } |
11 | 12 |
|
12 | 13 | return (
|
13 | 14 | <main className='container py-5'>
|
14 |
| - <Title title={title} style={titleStyle}/> |
| 15 | + <Title title={name} style={titleStyle} /> |
15 | 16 | <Row className='mt-3'>
|
16 | 17 | <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 | + /> |
20 | 24 | </Col>
|
21 | 25 | <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' /> |
23 | 27 | </Col>
|
24 | 28 | </Row>
|
25 | 29 | </main>
|
26 | 30 | )
|
27 | 31 | }
|
28 | 32 |
|
29 | 33 | ItemPage.propTypes = {
|
30 |
| - description: PropTypes.string.isRequired, |
31 | 34 | 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, |
34 | 39 | 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, |
35 | 47 | }
|
36 | 48 |
|
37 | 49 | ItemPage.defaultProps = {
|
|
0 commit comments