Skip to content

Commit

Permalink
✨ add 'square' option to grapher thumbnails
Browse files Browse the repository at this point in the history
  • Loading branch information
sophiamersmann committed Jan 14, 2025
1 parent ebce782 commit b4e84ea
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions functions/_common/imageOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ const OPEN_GRAPH_OPTIONS: ImageOptions = {
details: false,
fontSize: 21,
}
const SOCIAL_MEDIA_SQUARE_OPTIONS: ImageOptions = {
const SQUARE_OPTIONS: ImageOptions = {
pngWidth: 4 * GRAPHER_SQUARE_SIZE,
pngHeight: 4 * GRAPHER_SQUARE_SIZE,
svgWidth: GRAPHER_SQUARE_SIZE,
svgHeight: GRAPHER_SQUARE_SIZE,
details: false,
fontSize: undefined,
grapherProps: {
isSocialMediaExport: true,
isSocialMediaExport: false,
staticFormat: GrapherStaticFormat.square,
},
}
Expand All @@ -57,8 +57,14 @@ 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") === "social-media-square") {
const squareOptions = SOCIAL_MEDIA_SQUARE_OPTIONS
else if (
params.get("imType") === "square" ||
params.get("imType") === "social-media-square"
) {
const squareOptions = SQUARE_OPTIONS
if (params.get("imType") === "social-media-square") {
squareOptions.grapherProps.isSocialMediaExport = true
}
if (params.has("imSquareSize")) {
const size = parseInt(params.get("imSquareSize")!)
squareOptions.pngWidth = size
Expand Down

0 comments on commit b4e84ea

Please sign in to comment.