import type { Option } from "@guardian/types" ; import { OptionKind } from "@guardian/types" ; interface Lightbox { className : string ; caption : Option < string > ; credit : Option < string > ; } /**
 * Lightbox is only available for images above a certain size,
 * we don't enable it for small images (e.g. thumbnails). Therefore
 * this will only return a lightbox className if one is provided *and*
 * the image is above a certain width.
 */ const getClassName = ( imageWidth , lightbox ) : string | undefined => { if ( imageWidth > 620 && lightbox . kind === OptionKind . Some ) { return lightbox . value . className ; } return undefined ; } ; const getCaption = ( lightbox ) : string | undefined => { if ( lightbox . kind === OptionKind . Some && lightbox . value . caption . kind === OptionKind . Some ) { return lightbox . value . caption . value ; } return undefined ; } ; const getCredit = ( lightbox ) : string | undefined => { if ( lightbox . kind === OptionKind . Some && lightbox . value . credit . kind === OptionKind . Some ) { return lightbox . value . credit . value ; } return undefined ; } ; export type { Lightbox } ; export { getClassName , getCaption , getCredit } ;