Skip to content

Commit 1ec8be1

Browse files
removing initFunctions
1 parent 68a5cde commit 1ec8be1

22 files changed

+6
-186
lines changed

packages/unity-bootstrap-theme/.storybook/local-addon/addon.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,6 @@ import { formatWithBabelParser } from './helpers';
66
import { Toggle } from '../../../../.storybook-config/Toggle'
77

88
addons.register('local-addon', (api) => {
9-
addons.add('local-addon/panel', {
10-
title: 'Javascript',
11-
//👇 Sets the type of UI element in Storybook
12-
type: types.PANEL,
13-
paramKey: 'initFunc',
14-
render: ({active, key}) => {
15-
const data = api.getCurrentStoryData();
16-
const initFunc = data?.parameters?.initFunc?.code || '';
17-
const code = formatWithBabelParser(`${initFunc}`);
18-
19-
return(
20-
<AddonPanel key={key} active={!!active}>
21-
<Source code={`${code}`} language='js' format={true} />
22-
</AddonPanel>
23-
)},
24-
});
25-
269
addons.add('local-addon/tools', {
2710
title: 'tools',
2811
type: types.TOOL,

packages/unity-bootstrap-theme/.storybook/local-addon/decorators/withFooter.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,15 @@
1-
import React, { useEffect, useRef} from 'react';
1+
import React from 'react';
22
import { makeDecorator } from '@storybook/addons';
3-
43
import { GlobalElementsOnly as Footer } from "../../../stories/organisms/global-footer/global-footer.templates";
5-
import { initFooterGA } from "../../../stories/organisms/global-footer/global-footer"
64

75
export const withFooter = makeDecorator({
86
name: 'withFooter',
97
parameterName: 'footer',
108
skipIfNoParametersOrOptions: true,
119
wrapper: (storyFn, context) => {
12-
const loaded = useRef(0);
13-
useEffect(()=>{
14-
if(document.readyState !== "loading") {
15-
initFooterGA()
16-
}
17-
},[loaded.current]);
18-
loaded.current++;
19-
2010
const { globals, parameters } = context;
21-
2211
const footer = parameters?.footer;
2312
const isFooterActive = (globals.footer == true && footer?.disable !== true) || footer.forced == true;
24-
2513
const isStory = context.viewMode === 'story';
2614

2715
return <>

packages/unity-bootstrap-theme/.storybook/local-addon/decorators/withHeader.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,16 @@
1-
import React, { useEffect, useRef} from 'react';
1+
import React from 'react';
22
import { makeDecorator } from '@storybook/addons';
33

44
import { Basic as Header } from "../../../stories/organisms/global-header/global-header.templates.jsx";
55

6-
import { initGlobalHeader } from "../../../src/js/storybook-global-header";
7-
86
export const withHeader = makeDecorator({
97
name: 'withHeader',
108
parameterName: 'header',
119
skipIfNoParametersOrOptions: true,
1210
wrapper: (storyFn, context) => {
13-
const loaded = useRef(0);
14-
useEffect(()=>{
15-
if(document.readyState !== "loading") {
16-
initGlobalHeader()
17-
}
18-
},[loaded.current]);
19-
loaded.current++;
20-
2111
const { globals, parameters } = context;
22-
2312
const header = parameters?.header;
2413
const isHeaderActive = (globals.header == true && header?.disable !== true) || header.forced === true;
25-
2614
const isStory = context.viewMode === 'story';
2715

2816
return <>

packages/unity-bootstrap-theme/.storybook/local-addon/decorators/withInitFunc.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/unity-bootstrap-theme/.storybook/local-addon/decorators/withLoadEvent.js

Lines changed: 0 additions & 24 deletions
This file was deleted.

packages/unity-bootstrap-theme/.storybook/local-addon/entry.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import {
55

66
import { withFooter } from './decorators/withFooter';
77
import { withHeader } from './decorators/withHeader';
8-
import { withInitFunc } from './decorators/withInitFunc';
9-
import { withLoadEvent } from './decorators/withLoadEvent';
10-
11-
import "../../src/js/data-layer.js";
128

139
export const parameters = {
1410
header: {
@@ -20,10 +16,6 @@ export const parameters = {
2016
loadEvent: {
2117
disable: false
2218
},
23-
initFunc: {
24-
disable: true,
25-
code: null
26-
},
2719
docs:{
2820
source: {
2921
transform: (src,storyContext)=>{
@@ -40,8 +32,6 @@ export const globals = {
4032
footer: false
4133
}
4234
export const decorators = [
43-
withLoadEvent,
44-
withInitFunc,
4535
withHeader,
4636
withFooter,
4737
]

packages/unity-bootstrap-theme/.storybook/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export default {
44
staticDirs: ['../dist'],
55
stories: ["../stories/**/*.stories.mdx", "../stories/**/*.stories.@(js|jsx|ts|tsx)"],
66
addons: [
7+
"./local-addon",
78
"../../../.storybook-config",
89
"../../../.storybook-config/dataLayerListener",
910
"@whitespace/storybook-addon-html",

packages/unity-bootstrap-theme/stories/atoms/blockquote/blockquote.templates.stories.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@ import React from "react";
22

33
import { imageName } from "../../../../../shared/assets";
44
import { defaultDecorator } from "../../../../../shared/components/Layout.js";
5-
import { initializeBlockquoteAnimation as doAnimate } from "./blockquote-animated";
65

76
export default {
87
title: "Atoms/Blockquotes and Testimonials/Templates",
98
parameters: {
10-
initFunc: {
11-
disable: false,
12-
code: doAnimate,
13-
},
149
},
1510
args: {
1611
type: "On White",

packages/unity-bootstrap-theme/stories/atoms/modals/modals.examples.stories.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
import React from "react";
22

3-
import { initModals as initFunc } from "./modals.js";
4-
53
export default {
64
title: "Atoms/Modals/Examples",
75
parameters: {
8-
initFunc: {
9-
disable: false,
10-
code: initFunc
11-
},
126
header: {
137
forced: true,
148
},

packages/unity-bootstrap-theme/stories/atoms/modals/modals.templates.stories.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
import React from "react";
22

33
import { defaultDecorator } from "../../../../../shared/components/Layout";
4-
import { initModals as initFunc } from "./modals.js";
54

65
export default {
76
title: "Atoms/Modals/Templates",
87
decorators: [ defaultDecorator ],
98
parameters: {
10-
initFunc: {
11-
disable: false,
12-
code: initFunc
13-
},
149
header: {
1510
forced: true,
1611
},

0 commit comments

Comments
 (0)