Skip to content

Commit

Permalink
feat: add a useSdk hook. Move bundle sources to sdk file
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 2, 2020
1 parent 2693fee commit 677c684
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/hooks/useSdk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import useScript from './useScript';
import useStylesheet from './useStylesheet';
import { JS_BUNDLE, CSS_BUNDLE } from '../utils/sdk';

const useSdk = () => {
const scriptLoaded = useScript(JS_BUNDLE);
const stylesheetLoaded = useStylesheet(CSS_BUNDLE);

return scriptLoaded && stylesheetLoaded;
};

export default useSdk;
6 changes: 6 additions & 0 deletions src/utils/sdk.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const BASE_URL =
'//hypertext-sandbox.nr-assets.net/wanda--wanda-ec-ui--nr1-docs';
const RELEASE = 'release-1093';

export const JS_BUNDLE = `${BASE_URL}-${RELEASE}.js`;
export const CSS_BUNDLE = `${BASE_URL}-${RELEASE}.css`;

0 comments on commit 677c684

Please sign in to comment.