-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add an
Imaging order
button beneath usual Add to
button on `grid-…
…original` and render this new type of payload, with 'request type' dropdown etc.
- Loading branch information
1 parent
dde62df
commit 0d7dd60
Showing
10 changed files
with
198 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import { css } from "@emotion/react"; | ||
import React from "react"; | ||
import { ImagingOrderPayload } from "../types/PayloadAndType"; | ||
import { | ||
IMAGINE_REQUEST_TYPES, | ||
IMAGING_REQUEST_ITEM_TYPE, | ||
ImagingRequestType, | ||
} from "../../../shared/octopusImaging"; | ||
import { agateSans } from "../../fontNormaliser"; | ||
import { useGlobalStateContext } from "../globalState"; | ||
import { space } from "@guardian/source-foundations"; | ||
|
||
interface OctopusImagingOrderDisplayProps extends ImagingOrderPayload { | ||
isEditable?: boolean; | ||
} | ||
|
||
export const OctopusImagingOrderDisplay = ({ | ||
payload, | ||
isEditable, | ||
}: OctopusImagingOrderDisplayProps) => { | ||
const { setPayloadToBeSent } = useGlobalStateContext(); | ||
return ( | ||
<div | ||
css={css` | ||
${agateSans.xxsmall()} | ||
`} | ||
> | ||
<h3 | ||
css={css` | ||
margin: 0 0 ${space[1]}px; | ||
`} | ||
> | ||
Imaging Order | ||
</h3> | ||
{isEditable && ( | ||
<div | ||
css={css` | ||
padding-right: 25px; | ||
`} | ||
> | ||
<em> | ||
{ | ||
"Don't forget to provide some notes to help Imaging team to understand your request" | ||
} | ||
</em> | ||
</div> | ||
)} | ||
<img | ||
src={payload.thumbnail} | ||
css={css` | ||
object-fit: contain; | ||
width: 100%; | ||
height: 100%; | ||
`} | ||
draggable={false} | ||
// TODO: hover for larger thumbnail | ||
/> | ||
<div> | ||
<strong>Request Type: </strong> | ||
{isEditable ? ( | ||
<select | ||
onClick={(e) => e.stopPropagation()} | ||
onChange={(event) => | ||
setPayloadToBeSent({ | ||
type: IMAGING_REQUEST_ITEM_TYPE, | ||
payload: { | ||
...payload, | ||
requestType: event.target.value as ImagingRequestType, | ||
}, | ||
}) | ||
} | ||
> | ||
{IMAGINE_REQUEST_TYPES.map((requestType, index) => ( | ||
<option key={index}>{requestType}</option> | ||
))} | ||
</select> | ||
) : ( | ||
payload.requestType | ||
)} | ||
</div> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const IMAGING_REQUEST_ITEM_TYPE = "imaging-request"; | ||
|
||
export const IMAGINE_REQUEST_TYPES = [ | ||
"Cut out", // only 'cut out' is required for now | ||
// "Break out", | ||
// "Retouch", | ||
] as const; | ||
|
||
export type ImagingRequestType = (typeof IMAGINE_REQUEST_TYPES)[number]; |