Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Add headless embeddable mode #65

Merged
merged 8 commits into from
May 26, 2021
Merged

Add headless embeddable mode #65

merged 8 commits into from
May 26, 2021

Conversation

obulat
Copy link
Contributor

@obulat obulat commented May 20, 2021

Fixes #63
This PR adds headless embeddable mode to the application so that we can embed it into an iframe.

Embedded mode

The default mode embedded mode has smaller header without logo, and no footer. You can also explicitly set the embedded mode by using a embedded=true parameter in the URL http://localhost:8443/?embedded=true . A router middleware checks for this parameter, and saves any changes to the vuex store.

Screen Shot 2021-05-20 at 1 41 38 PM


Standalone mode

The standalone mode, with a larger header, logo and footer, can be activated through the embedded=false parameter in the URL: http://localhost:8443/?embedded=false when running locally.

Screen Shot 2021-05-20 at 1 44 26 PM

Copy link
Member

@zackkrida zackkrida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the middleware + vuex approach, works well with the existing data model.

Can you switch the h1 in the hero in embedded mode to just say "Openverse"? I feel like the existing text is redundant anyway 😆

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed this on Slack but I just wanted to formalize it as a comment. When running in embedded mode, a message should be posted to the window.parent containing the page height so that the embedder can set the proper height on the iframe. This message should be posted on first load, and subsequently after every resize of the viewport width.

A simple object containing a height property should be sufficient for the message argument in postMessage.

Example: resize_test.html at WordPress/wordpress.org#31

@zackkrida zackkrida merged commit 54bc7c2 into develop May 26, 2021
@zackkrida zackkrida deleted the embedded_mode branch May 26, 2021 17:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Headless version for embedding
3 participants