1 | import "core-js/modules/web.url.js";
|
2 | import "core-js/modules/es.object.to-string.js";
|
3 | import "core-js/modules/es.string.iterator.js";
|
4 | import "core-js/modules/es.array.iterator.js";
|
5 | import "core-js/modules/web.dom-collections.iterator.js";
|
6 | import React, { useContext } from 'react';
|
7 | import global from 'global';
|
8 | import { Anchor } from './Anchor';
|
9 | import { DocsContext } from './DocsContext';
|
10 | var document = global.document;
|
11 |
|
12 | function getFirstStoryId(docsContext) {
|
13 | var stories = docsContext.componentStories();
|
14 | return stories.length > 0 ? stories[0].id : null;
|
15 | }
|
16 |
|
17 | function renderAnchor() {
|
18 | var context = useContext(DocsContext);
|
19 | var anchorId = getFirstStoryId(context) || context.id;
|
20 | return React.createElement(Anchor, {
|
21 | storyId: anchorId
|
22 | });
|
23 | }
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | export var Meta = function Meta() {
|
31 | var params = new URL(document.location).searchParams;
|
32 | var isDocs = params.get('viewMode') === 'docs';
|
33 | return isDocs ? renderAnchor() : null;
|
34 | }; |
\ | No newline at end of file |