Skip to content

Commit

Permalink
🐝 extract imType as variable
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelgerber authored and sophiamersmann committed Jan 21, 2025
1 parent 61525ac commit 55ad01f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions functions/_common/imageOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ const SQUARE_OPTIONS: Readonly<ImageOptions> = {
}

export const extractOptions = (params: URLSearchParams): ImageOptions => {
// We have two special images types specified via the `imType` query param:
if (params.get("imType") === "twitter") return TWITTER_OPTIONS
else if (params.get("imType") === "og") return OPEN_GRAPH_OPTIONS
else if (
params.get("imType") === "square" ||
params.get("imType") === "social-media-square"
) {
const imType = params.get("imType")
// We have some special images types specified via the `imType` query param:
if (imType === "twitter") return TWITTER_OPTIONS
else if (imType === "og") return OPEN_GRAPH_OPTIONS
else if (imType === "square" || imType === "social-media-square") {
const squareOptions = structuredClone(SQUARE_OPTIONS) as ImageOptions
if (params.get("imType") === "social-media-square") {
if (imType === "social-media-square") {
squareOptions.grapherProps.isSocialMediaExport = true
}
if (params.has("imSquareSize")) {
Expand Down

0 comments on commit 55ad01f

Please sign in to comment.