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

Lightbox 2.0: be able to expand overflown caption #10105

Merged
merged 3 commits into from Jun 23, 2017

Conversation

muxin
Copy link
Contributor

@muxin muxin commented Jun 23, 2017

  • default caption
    • gradient background
    • trimmed text
    • positioned at bottom of viewport
  • expanded caption
    • pure background with transparency
    • full screen
    • caption not overflown
      • positioned at bottom
    • caption overflown
      • scrollable

Partial for #9970, more about transition coming in another PR

@muxin muxin force-pushed the lightbox-overflown-caption branch from 6b37713 to f3f7941 Compare June 23, 2017 00:15
opacity: 1;
transition: opacity 1s;
}

.i-amphtml-lbv-desc-box.standard {
max-height: 100px;
Copy link
Contributor

Choose a reason for hiding this comment

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

using a unit tied to font-size will be better here. Maybe something around 7rem;?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but I think using em could also be fine? It's the size of the description box after all.

Copy link
Contributor

Choose a reason for hiding this comment

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

we should avoid em since it is relative to ancestor's font-size. Given lightbox-viewer is always child of body, it does not matter much in this case but rem is preferred.

* @private
*/
toggleDescriptionOverflow_() {
if (this.descriptionBox_.classList.contains('standard')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

use vsyn and do the scrollHeight clientHeight reads in the measure block and then mutate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

opacity: 1;
transition: opacity 1s;
}

.i-amphtml-lbv-desc-box.standard {
max-height: 6em;
Copy link
Contributor

Choose a reason for hiding this comment

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

let's do rem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok~

if (this.descriptionBox_.classList.contains('standard')) {
this.descriptionBox_.classList.remove('standard');
this.descriptionBox_.classList.add('overflow');
let descBoxHeight = -1, descTextAreaHeight = -1;
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use the state provided by vsyn to hold there values

measure: state => {
state.foo = 'bar';
},
mutate: state => {
state.foo
}


Copy link
Contributor Author

Choose a reason for hiding this comment

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

good idea, done

@muxin muxin merged commit 306a4b0 into ampproject:master Jun 23, 2017
@muxin muxin deleted the lightbox-overflown-caption branch June 23, 2017 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants