Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components and AMP layout rules #35

Open
dvoytenko opened this issue Oct 31, 2019 · 0 comments
Open

Components and AMP layout rules #35

dvoytenko opened this issue Oct 31, 2019 · 0 comments
Labels
TBD To be discussed/design decisions

Comments

@dvoytenko
Copy link
Contributor

Currently AMP elements are structured like this:

<amp-element>      <- AmpElement (custom element wrapper)
                     <- defines layout/size
  <container>      <- BaseElement (implementation)
                     <- adheres to the layout defined by AmpElement

Some of the most critical layout styles are:

  • display: block|etc (but not "inline");
  • proxies for width and height;
  • position: relative|absolute|etc (but not "static");
  • overflow: hidden.

React components follow AMP's BaseElement layer which means that they accept layout, but normally do not define their own static layout.

Besides layout, AmpElement is also responsible for showing placeholder and loading indicator. This is especially important since the placeholder and loading indicator are shown this way even before the BaseElement implementation script has been downloaded.

To still allow static layout in the React/AMP layer, we could provide AmpLayout component that could implement layout/placeholder/loading-indicator features via composition.

@dvoytenko dvoytenko added the TBD To be discussed/design decisions label Oct 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TBD To be discussed/design decisions
Projects
None yet
Development

No branches or pull requests

1 participant