Skip to content

Commit 2ef3e9f

Browse files
committed
Merge branch 'main' into 93-pass-the-service-name
2 parents 6f85132 + 517c2eb commit 2ef3e9f

File tree

6 files changed

+29
-28
lines changed

6 files changed

+29
-28
lines changed

src/components/AdditionalInfo/AdditionalInfo.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ import PropTypes from 'prop-types'
33
import {
44
Card, CloseButton, Form, ListGroup,
55
} from 'react-bootstrap'
6-
import { convertToBase64, apiV2CompatibleStrings } from '../../resources/utilityFunctions'
6+
import { addDays, apiV2CompatibleStrings, convertToBase64 } from '../../resources/utilityFunctions'
77

88
const AdditionalInfo = ({ updateRequestForm }) => {
99
const [showProposalDate, setShowProposalDate] = useState(true)
1010
const [files, setFiles] = useState([])
11-
const today = new Date().toISOString().slice(0, 10)
1211
const fileRef = useRef(null)
12+
const oneWeekFromNow = addDays((new Date()), 7).toISOString().slice(0, 10)
13+
const oneDayFromNow = addDays((new Date()), 1).toISOString().slice(0, 10)
1314

1415
const handleChange = (value) => {
1516
updateRequestForm(value, 'proposedDeadline')
@@ -52,7 +53,8 @@ const AdditionalInfo = ({ updateRequestForm }) => {
5253
<Form.Control
5354
className='prevent-validation-styles'
5455
type='date'
55-
min={today}
56+
min={oneDayFromNow}
57+
defaultValue={oneWeekFromNow}
5658
placeholder='Proposals Required By'
5759
disabled={showProposalDate === false}
5860
onChange={showProposalDate && ((e) => handleChange(e.target.value))}

src/compounds/Item/Item.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Item = ({ buttonLink, buttonProps, href, fromItemGroup, isLoading, item, o
3434
<div className='row g-0 h-100'>
3535
<div className='col-3'>
3636
<Image
37-
className={orientation === 'horizontal' ? 'img-fluid h-100 rounded-start cover-horizontal' : 'card-img-top'}
37+
className={`cover ${orientation === 'horizontal' ? 'img-fluid h-100 rounded-start' : 'card-img-top'}`}
3838
src={src}
3939
alt={alt}
4040
/>
@@ -55,7 +55,7 @@ const Item = ({ buttonLink, buttonProps, href, fromItemGroup, isLoading, item, o
5555
) : (
5656
<>
5757
<Image
58-
className={orientation === 'horizontal' ? 'img-fluid h-100 rounded-start cover' : 'card-img-top'}
58+
className={`cover ${orientation === 'horizontal' ? 'img-fluid h-100 rounded-start' : 'card-img-top'}`}
5959
src={src}
6060
alt={alt}
6161
/>

src/compounds/Item/item.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
white-space: nowrap;
33
}
44

5-
.cover-horizontal {
5+
.cover {
66
object-fit: cover;
77
height: 200px;
88
width: 100%;
99
}
1010

1111
.link-hover:hover {
1212
opacity: .8;
13-
}
13+
}
14+

src/compounds/ItemPage/ItemPage.jsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
import React from 'react'
22
import PropTypes from 'prop-types'
3+
import { Button, Row, Col } from 'react-bootstrap'
34
import Image from '../../components/Image/Image'
45
import TextBox from '../../components/TextBox/TextBox'
56
import Title from '../../components/Title/Title'
6-
import './item-page.css'
77

88
const ItemPage = ({ title, titleStyle, description, descriptionStyle, img }) => {
99
// sets a default width while still allowing width to be overridden
1010
img = { width: 400, ...img }
1111

1212
return (
13-
<main className='container item-page'>
14-
<Title title={title} style={titleStyle} />
15-
<div className='item-page-details'>
16-
<TextBox text={description} style={descriptionStyle} size='medium' />
17-
<Image {...img} />
18-
</div>
13+
<main className='container py-5'>
14+
<Title title={title} style={titleStyle}/>
15+
<Row className='mt-3'>
16+
<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>
20+
</Col>
21+
<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} />
23+
</Col>
24+
</Row>
1925
</main>
2026
)
2127
}

src/compounds/ItemPage/item-page.css

Lines changed: 0 additions & 14 deletions
This file was deleted.

src/resources/utilityFunctions.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ export const convertToBase64 = (fileArray) => fileArray.map((file) => new Promis
99
fileReader.onload = () => resolve(fileReader.result)
1010
fileReader.onerror = (error) => reject(new Error(error))
1111
}))
12+
13+
// used to add days to a new Date() in the AdditionalInfo component
14+
export const addDays = (date, days) => {
15+
date.setDate(date.getDate() + days)
16+
return date
17+
}

0 commit comments

Comments
 (0)