Skip to content

Commit a53dcd4

Browse files
committed
use the full ware instead of all different props, fix linting errors
1 parent 3854229 commit a53dcd4

File tree

2 files changed

+29
-15
lines changed

2 files changed

+29
-15
lines changed

src/compounds/ItemPage/ItemPage.jsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,44 @@ import LinkedButton from '../LinkedButton/LinkedButton'
66
import TextBox from '../../components/TextBox/TextBox'
77
import Title from '../../components/Title/Title'
88

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

1313
return (
1414
<main className='container py-5'>
15-
<Title title={title} style={titleStyle}/>
15+
<Title title={name} style={titleStyle} />
1616
<Row className='mt-3'>
1717
<Col xs={12} md={6} className='d-flex flex-column'>
18-
<TextBox text={description} style={descriptionStyle} size='medium' />
18+
<TextBox text={description || snippet} style={descriptionStyle} size='medium' />
1919
<LinkedButton
2020
addClass='align-self-start mt-4'
2121
buttonProps={{ label: 'Initiate Request' }}
22-
path={{ pathname: `/requests/new/${slug}`, query: { id }}}
22+
path={{ pathname: `/requests/new/${slug}`, query: { id } }}
2323
/>
2424
</Col>
2525
<Col xs={12} md={6} className='mt-4 mt-md-0 me-md-auto d-flex justify-content-start justify-content-md-end'>
26-
<Image {...img} />
26+
<Image {...img} addClass='img-fluid'/>
2727
</Col>
2828
</Row>
2929
</main>
3030
)
3131
}
3232

3333
ItemPage.propTypes = {
34-
description: PropTypes.string.isRequired,
3534
descriptionStyle: PropTypes.shape({}),
36-
id: PropTypes.number.isRequired,
3735
img: PropTypes.shape({
3836
alt: PropTypes.string.isRequired,
3937
src: PropTypes.string.isRequired,
40-
}),
41-
slug: PropTypes.string.isRequired,
42-
title: PropTypes.string.isRequired,
38+
}).isRequired,
4339
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,
4447
}
4548

4649
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)