Skip to content

Commit

Permalink
Fix video file metadata not passed from docs page template to component
Browse files Browse the repository at this point in the history
The `Video` (1) component maps the video file metadata received from
`props.sources` (array of objects) to the `<source>` HTML tag, but for
docs pages the MDX [`DocsPage`][dp] component was only passed down the
`publicUrl` metadata field resulting in a array of strings. This caused
the `Video` component failing to load the video file(s) for MDX docs
pages.
To fix the invalid mapping the `DocsPage` component now passes down the
whole video file metadata object instead of only the `publicUrl`
(string) field.

References:
  (1) https://github.com/arcticicestudio/nord-docs/blob/3b4f7273e00532c2a7506030e604f56492886acf/src/components/atoms/core/mdx-elements/Video.jsx#L93-L94
  (2) https://github.com/arcticicestudio/nord-docs/blob/eda9240912dc8005e3297ee82471f9da8da10980/src/components/templates/docs/DocsPage.jsx#L48

Fixes GH-157
  • Loading branch information
arcticicestudio committed Jun 16, 2019
1 parent 9569306 commit ce1f576
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/templates/docs/DocsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const DocsPage = ({ data: { images, mdx, videos }, location: { pathname }, ...pa
});
const docsPageVideos = {};
videos?.edges?.forEach(({ node }) => {
docsPageVideos[`${node.name}.${node.extension}`] = node.publicURL;
docsPageVideos[`${node.name}.${node.extension}`] = node;
});

return (
Expand Down

0 comments on commit ce1f576

Please sign in to comment.