Coder Social home page Coder Social logo

newspack-app-shell's Introduction

Newspack App Shell

Objective: A persistent audio player. User should be able to navigate the page, while the audio player is playing.

How to prepare the theme

  1. If there is any JS code that attaches handlers after DOM loads, it has to re-attach them on newspack-app-shell-ready
  2. CSS transitions can be added by utilising the newspack-app-shell-transitioning class that is added to the body element while page is transitioning.
  3. If theme is using the AMP-WP plugin, the AMP plugin should be run in Transitional mode, because AMP will not allow the custom script on AMP pages.

Background

Based on work done in AMP-WP plugin. The scope of this work is bigger that what we want to achieve here. In the future the Newspack App Shell plugin might be abandoned in favour of the App Shell feature of AMP-WP plugin.

newspack-app-shell's People

Contributors

adekbadek avatar dependabot[bot] avatar jeffersonrabb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

newspack-app-shell's Issues

Handle any content element

Currently (#3 ) the CONTENT_ELEMENT_ID is set to page - that's how it is in newspack-theme. Other themes might have different ways of rendering the site.

E.g. twentytwenty theme renders the page contents in separate elements (header, main, footer, etc) as direct children of the body, which makes it more complicated to replace in a way that preserves order. But maybe in such a scenario (no single content wrapper) the diffing should always replace all elements in body.
The problem is not existent in the head, as the order does not matter there.

Possible to create more than 1 app shell

Screen Shot 2020-02-04 at 12 02 09 PM

You can use the admin toolbar to create additional app shells. I believe there's a param you can pass in when registering the post type to prevent it from appearing in this menu.

Handle Jetpack's lazy loaded images

As is:

After page is re-rendered on the client, and Jetpack's lazy load images feature is used, the images are not displayed.

To be:

The images should be displayed

Page transitions

Add a setting and CSS to animate body element on page transitions

Handling AMP

The client script makes pages using it AMP-incompatible. The AMP plugin will then strip it away. The "persistent element" might however be AMP-compatible, which would result in a situation where the element is displayed, but the script is not there (when serving an AMP page, with /?amp in URL).

This situation should be handled as on NovaFM site, where the play button (part of the persistent element) is a link to the non-AMP page, when page is AMP-rendered.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.