Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 2x 4x 4x 2x 2x | import React from 'react'
import * as PropTypes from 'prop-types'
import * as generalUtils from 'common/utils/general.utils'
import { BiChair } from 'react-icons/bi'
import Button from 'common/components/button'
import './OfficeCard.scss'
const OfficeCard = ({ time, seat, onBook, translate }) => {
const timeFormatted = generalUtils.formattedRoundHour(time)
return (
<div className="office-card animate__animated animate__fadeIn" role="listitem">
<div className="office-card__content">
<div
className="office-card__time"
aria-label={translate('Time: {time}', { time: timeFormatted })}
>
{timeFormatted}
</div>
<div className="office-card__seats">
<div className="office-card__seats--icon" role="presentation" aria-hidden="true">
<BiChair />
</div>
<div
className="office-card__seats--text"
aria-label={translate('Seats available: {seat}', { seat })}
>
{seat}
</div>
</div>
</div>
<div className="office-card__footer">
<Button onClick={() => onBook({ seat, time })}>{translate('Book')}</Button>
</div>
</div>
)
}
OfficeCard.defaultProps = {
translate: (value) => value,
}
OfficeCard.propTypes = {
translate: PropTypes.func,
time: PropTypes.number,
seat: PropTypes.number,
onBook: PropTypes.func,
}
export default OfficeCard
|