Skip to content

Commit 9089670

Browse files
chore(unity-bootstrap-theme): add helpful comments for storybook force refresh
1 parent 51d6210 commit 9089670

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

packages/unity-bootstrap-theme/stories/molecules/cookie-consent/cookie-consent-full-screen.stories.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import React, { useEffect } from "react";
22
import { allCookieConsentJS } from "../../../src/js/cookie-consent-full-screen.js";
3+
import "../../../src/css/cookie-consent-full-screen.css";
34

45
export default {
56
title: "Molecules/Cookie Consent",
7+
// Forces reload of the story to keep css and js from persisting between stories
68
decorators: [
79
(storyFn, context) => {
810
useEffect(() => {
@@ -25,13 +27,6 @@ export default {
2527
export const FullScreenBannerCookieConsent = () => {
2628
useEffect(() => {
2729
allCookieConsentJS();
28-
const loadCSS = async () => {
29-
const cssModule = await import("../../../src/css/cookie-consent-full-screen.css", {
30-
assert: { type: 'css' }
31-
});
32-
document.adoptedStyleSheets = [cssModule.default];
33-
};
34-
loadCSS();
3530
}, []);
3631

3732
return (

packages/unity-bootstrap-theme/stories/molecules/cookie-consent/cookie-consent.stories.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import React, { useEffect } from "react";
22
import { allCookieConsentJS } from "../../../src/js/cookie-consent";
3+
import "../../../src/css/cookie-consent.css";
34

45
export default {
56
title: "Molecules/Cookie Consent",
7+
// Forces reload of the story to keep css and js from persisting between stories
68
decorators: [
79
(storyFn, context) => {
810
useEffect(() => {
@@ -23,13 +25,6 @@ export default {
2325
export const MaxWidthCookieConsent = () => {
2426
useEffect(() => {
2527
allCookieConsentJS();
26-
const loadCSS = async () => {
27-
const cssModule = await import("../../../src/css/cookie-consent.css", {
28-
assert: { type: 'css' }
29-
});
30-
document.adoptedStyleSheets = [cssModule.default];
31-
};
32-
loadCSS();
3328
}, []);
3429

3530
return (

0 commit comments

Comments
 (0)