Skip to content

Commit

Permalink
Make editGithubUrl a optional
Browse files Browse the repository at this point in the history
  • Loading branch information
imagoiq committed Nov 13, 2023
1 parent cca4329 commit f6c4468
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/documentation/.storybook/blocks/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ function getGitHubUrl(path: String) {
return `${BASEURL}${path.replace(/^\./, '').replace(/\.stories\.ts$/, '.docs.mdx')}`;
}

export default (params: { pathToStoryFile: String }) => (
export default (params: { pathToStoryFile?: String }) => (
<>
<div className="container mt-huge font-size-18 text-end">
<a href={getGitHubUrl(params.pathToStoryFile)} target="_blank" rel="noopener">
Edit this page on GitHub
</a>
{params.pathToStoryFile && (
<a href={getGitHubUrl(params.pathToStoryFile)} target="_blank" rel="noopener">
Edit this page on GitHub
</a>
)}
</div>
<footer className="docs-footer mt-huge bg-light">
<div className="container">
Expand Down
3 changes: 2 additions & 1 deletion packages/documentation/.storybook/blocks/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { PropsWithChildren } from 'react';
import '../styles/layout.scss';
import Footer from './footer';
import Header from './header';
import { ifDefined } from 'lit/directives/if-defined.js';

function shouldShowHeader() {
return new URLSearchParams(window.location.search).get('id') === 'home--docs';
Expand All @@ -25,7 +26,7 @@ export default (props: PropsWithChildren<DocsContainerProps>) => {
<Unstyled>
{shouldShowHeader() && <Header />}
<div className={container}>{children}</div>
{shouldShowFooter() && <Footer pathToStoryFile={pathToStoryFile} />}
{shouldShowFooter() && <Footer pathToStoryFile={ifDefined(pathToStoryFile)} />}
</Unstyled>
</DocsContainer>
);
Expand Down

0 comments on commit f6c4468

Please sign in to comment.