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

Addon-docs: Fix scroll behavior on page navigation #9331

Merged
merged 2 commits into from
Jan 6, 2020

Conversation

patricklafrance
Copy link
Member

@patricklafrance patricklafrance commented Jan 5, 2020

Issue: #8914

What I did

  • The meta component renders an anchor with the id of the stories if the page contains any story, otherwise if it's a docs only page, it renders the docs page id.

How to test

  • Is this testable with Jest or Chromatic screenshots? No
  • Does this need a new example in the kitchen sink apps? No, it can be tested with the current addon-docs stories of official-storybook.
  • Does this need an update to the documentation? No

If your answer is yes to any of these, please make sure to include it in your PR.

@vercel
Copy link

vercel bot commented Jan 5, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/storybook/monorepo/kxhju6fsx
✅ Preview: https://monorepo-git-8914-add-anchor-to-meta.storybook.now.sh

export const Meta: FunctionComponent<MetaProps> = props => null;
export const Meta: FC<MetaProps> = () => {
const params = new URL(document.location).searchParams;
const isDocs = params.get('viewMode') === 'docs';
Copy link
Member Author

Choose a reason for hiding this comment

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

Is there a better way to do this @shilman ?

Copy link
Member

Choose a reason for hiding this comment

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

Not yet!

@shilman shilman added this to the 6.0.0 milestone Jan 6, 2020
@shilman shilman changed the title Meta component render an anchor Addon-docs: Meta component render an anchor Jan 6, 2020
@shilman shilman changed the title Addon-docs: Meta component render an anchor Addon-docs: Fix scroll behavior on page navigation Jan 6, 2020
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for fixing this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants