Skip to content

Commit

Permalink
chore: add user guiding script
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriele-ct committed Mar 1, 2024
1 parent 72279d8 commit 4bb526f
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/gatsby-theme-docs/src/components/user-guiding.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import PropTypes from 'prop-types';
import { Script } from 'gatsby';

const UserGuiding = (props) => {
return props.ugId ? (
<Script
src={`https://static.userguiding.com/media/user-guiding-${props.ugId}-embedded.js`}
/>
) : null;
};

UserGuiding.propTypes = {
ugId: PropTypes.string,
};

export default UserGuiding;
2 changes: 2 additions & 0 deletions packages/gatsby-theme-docs/src/templates/homepage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { PageDataContext } from '../hooks/use-page-data';
import LayoutContentHomepage from '../layouts/content-homepage';
import { SEO, ThemeProvider } from '../components';
import markdownComponents from '../markdown-components';
import UserGuiding from '../components/user-guiding';

const HomepageTemplate = (props) => (
<IntlProvider locale="en">
Expand Down Expand Up @@ -69,6 +70,7 @@ export function Head({ data, pageContext }) {
// eslint-disable-next-line react/prop-types
excludeFromSearchIndex={data.contentPage.excludeFromSearchIndex}
/>
<UserGuiding ugId={'U4I78799B6RID'} />
</ThemeProvider>
);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/gatsby-theme-docs/src/templates/page-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SEO, ThemeProvider } from '../components';
import markdownComponents from '../markdown-components';
import { PageDataContext } from '../hooks/use-page-data';
import ChildSectionsNav from '../components/child-sections-nav';
import UserGuiding from '../components/user-guiding';

const ContentCards = (props) => (
<markdownComponents.Cards fitContentColumn={true} {...props} />
Expand Down Expand Up @@ -82,6 +83,7 @@ export function Head({ data, pageContext }) {
// eslint-disable-next-line react/prop-types
excludeFromSearchIndex={data.contentPage.excludeFromSearchIndex}
/>
<UserGuiding ugId={'U4I78799B6RID'} />
</ThemeProvider>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import LayoutReleaseNotesDetail from '../layouts/release-notes-detail';
import LayoutReleaseNoteBody from '../layouts/internals/layout-release-note-body';
import { SEO, ThemeProvider } from '../components';
import markdownComponents from '../markdown-components';
import UserGuiding from '../components/user-guiding';

const releaseNoteMarkdownComponents = {
...markdownComponents,
Expand Down Expand Up @@ -68,6 +69,7 @@ export function Head({ data }) {
// eslint-disable-next-line react/prop-types
excludeFromSearchIndex={data.releaseNotePage.excludeFromSearchIndex}
/>
<UserGuiding ugId={'U4I78799B6RID'} />
</ThemeProvider>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { SEO, ThemeProvider } from '../components';
import markdownComponents from '../markdown-components';
import useFilteredReleaseNotes from '../hooks/use-filtered-release-notes';
import GatsbyLink from '../components/link';
import UserGuiding from '../components/user-guiding';

const ReleaseNotesListTemplate = (props) => {
const filteredReleaseNotes = useFilteredReleaseNotes(
Expand Down Expand Up @@ -98,6 +99,7 @@ export function Head({ data }) {
// eslint-disable-next-line react/prop-types
excludeFromSearchIndex={data.contentPage.excludeFromSearchIndex}
/>
<UserGuiding ugId={'U4I78799B6RID'} />
</ThemeProvider>
);
}
Expand Down

0 comments on commit 4bb526f

Please sign in to comment.