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

Visual story 2 #304

Merged
merged 46 commits into from
Dec 4, 2020
Merged

Visual story 2 #304

merged 46 commits into from
Dec 4, 2020

Conversation

ags1773
Copy link
Collaborator

@ags1773 ags1773 commented Nov 4, 2020

position: relative;
height: 50px;
margin: auto;
`;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

<CoverPage /> is the 1st card of the visual story. It uses the heroImage as background. It's not shown if hero image isn't present

function padZero(str) {
const zeros = new Array(2).fill("0");
return `${zeros}${str}`.slice(-2);
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is needed to invert theme colors used by text elements.. Visual stories use a dark background, so it's kinda like dark mode

<Theme tokens={tokens}>{children}</Theme>
</StoryProvider>
</ConfigProvider>
);
Copy link
Collaborator Author

@ags1773 ags1773 Nov 4, 2020

Choose a reason for hiding this comment

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

Usually we use <Layout /> as context provider, but we can't use it here because

  1. we're using different theme tokens
  2. Layout adds a div (which sets width of story to 600px).. visual stories don't need this

@ags1773 ags1773 requested a review from himani39 November 4, 2020 06:28
<div grid-area="lower-third">
<StyledTextWrapper>
<StyledHeadline>{headline}</StyledHeadline>
{authorNames && (
Copy link
Contributor

Choose a reason for hiding this comment

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

What about Date Published and Section name ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ahead's visual stories doesn't have them right? is this a requirement?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope. Thought we are doing it as per our header card.

@ags1773
Copy link
Collaborator Author

ags1773 commented Nov 4, 2020

Haven't added tests yet.. working on them and documentation

@ags1773
Copy link
Collaborator Author

ags1773 commented Nov 10, 2020

Corresponding PR in framework quintype/quintype-node-framework#181

}
};
```

Copy link
Contributor

Choose a reason for hiding this comment

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

Do specify mandatory/optional for each of the below, along with he default values for optional ones.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, will do that

featureConfig: {
visualStories: {
autoAdvanceAfter: "5s",
bookendUrl: "/foo.json",
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding "/amp/api/v1/bookend.json" could serve as better example

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok

import { withStoryAndConfig } from "../../../context";

export const AmpStoryPageBase = ({ config, story, children, ...props }: AmpStoryPageTypes) => {
const autoAdvanceAfter = get(config, ["opts", "featureConfig", "visualStories", "autoAdvanceAfter"], null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Setting default to null could be a problem as the document specifies it must be A positive amount of time

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If an attribute is null, React won't add it
source

if (!imgAnimationFeatCfg) return null;

return {
...(imgAnimationFeatCfg.animateIn && { "animate-in": imgAnimationFeatCfg.animateIn }),
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding zoom-in as default value for when animateIn is not passed in config.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, can do that

huge: "40px"
}
};
};
Copy link
Collaborator Author

@ags1773 ags1773 Dec 3, 2020

Choose a reason for hiding this comment

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

These CSS tokens override the default tokens. Since visual stories don't give as much emphasis to text content as text stories, the font size, line height, spacing etc. need to be lesser than text stories, hence this change.

Before:
Screenshot 2020-12-01 at 6 21 10 PM

After:
Screenshot 2020-12-03 at 3 59 27 PM

@ags1773 ags1773 merged commit 110de83 into master Dec 4, 2020
@delete-merged-branch delete-merged-branch bot deleted the visual-story-2 branch December 4, 2020 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants