Skip to content

Commit 0900210

Browse files
feat(unity-bootstrap-theme): update dist files and README docs for usage
1 parent d36fcf9 commit 0900210

26 files changed

+216
-152
lines changed

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,29 @@
11
import React from 'react';
22
import { AddonPanel } from '@storybook/components';
3-
import { Source } from '@storybook/blocks';
43
import { addons, types } from '@storybook/addons';
5-
import { formatWithBabelParser } from './helpers';
64
import { Toggle } from '../../../../.storybook-config/Toggle'
75

86
addons.register('local-addon', (api) => {
7+
addons.add('local-addon/panel', {
8+
title: 'Javascript',
9+
//👇 Sets the type of UI element in Storybook
10+
type: types.PANEL,
11+
paramKey: 'initFunc',
12+
render: ({active, key}) => {
13+
14+
return(
15+
<AddonPanel key={key} active={!!active}>
16+
<div style={{ padding: '20px', fontSize: '1rem'}}>
17+
18+
This component requires Javascript. <br/><br/>
19+
20+
<a href="./?path=/docs/get-started-get-started--docs#-including-unity-in-your-project">View the documentation</a>{" "}on how to use the component in your project.
21+
22+
</div>
23+
</AddonPanel>
24+
)},
25+
});
26+
927
addons.add('local-addon/tools', {
1028
title: 'tools',
1129
type: types.TOOL,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export const parameters = {
1616
loadEvent: {
1717
disable: false
1818
},
19+
initFunc: {
20+
disable: true
21+
},
1922
docs:{
2023
source: {
2124
transform: (src,storyContext)=>{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import "./eventSpy.js";
22
import "../src/scss/unity-bootstrap-theme.bundle.scss";
33
import { default as bootstrap } from "bootstrap/js/index.umd.js";
44
globalThis.bootstrap = bootstrap;
5-
import { default as udsBootstrap } from "@asu/unity-bootstrap-theme/src/js/unity-bootstrap-theme.js";
5+
import { default as udsBootstrap } from "../src/js/unity-bootstrap.js";
66
globalThis.udsBootstrap = udsBootstrap;
77

88
import { removeFontAwesomeChanges } from "./local-addon/helpers";

packages/unity-bootstrap-theme/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"url": "git+https://github.com/ASU/asu-unity-stack.git"
1414
},
1515
"scripts": {
16-
"build": "yarn build:1 && yarn build:2",
17-
"build:1": "vite build",
18-
"build:2": "vite build --config vite.config.bundle.js",
16+
"build": "yarn build:css && yarn build:js",
17+
"build:css": "vite build",
18+
"build:js": "vite build --config vite.config.bundle.js",
1919
"watch": "rimraf ./dist && webpack --watch && rimraf ./.tmp",
2020
"storybook": "storybook dev -p 9000",
2121
"build-storybook": "storybook build -o ../../build/$npm_package_name",
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EventHandler } from "./bootstrap-helper";
22

33
// method ot handle the custom behavior of the ranking card
4-
function rankingFunc() {
4+
function initRankingCard() {
55
const $infoLayer = document.querySelector(".info-layer");
66
const $toggleIcon = document.getElementById("dispatch");
77

@@ -11,6 +11,6 @@ function rankingFunc() {
1111

1212
};
1313

14-
EventHandler.on(window, 'load.uds.ranking-card', rankingFunc);
14+
EventHandler.on(window, 'load.uds.ranking-card', initRankingCard);
1515

16-
export { rankingFunc };
16+
export { initRankingCard };

packages/unity-bootstrap-theme/src/js/tabbed-panels.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { EventHandler } from "./bootstrap-helper";
22

3-
function initTabs() {
3+
function initTabbedPanels() {
44
("use strict");
55

66
const DOM_ELEMENT_A = "a";
@@ -138,8 +138,8 @@ function initTabs() {
138138
});
139139
}
140140

141-
EventHandler.on(window, 'load.uds.tabs', initTabs);
141+
EventHandler.on(window, 'load.uds.tabs', initTabbedPanels);
142142

143143
// window.addEventListener("load.uds.tabs", initTabs, true);
144144

145-
export { initTabs };
145+
export { initTabbedPanels };

packages/unity-bootstrap-theme/src/js/tables.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import { EventHandler } from "./bootstrap-helper";
1515

1616

17-
function initializeFixedTable() {
17+
function initFixedTable() {
1818
function setPreButtonPosition() {
1919
const wrapperSelector = '.uds-table-fixed-wrapper';
2020
const tableSelector = '.uds-table.uds-table-fixed table';
@@ -74,6 +74,6 @@ function initializeFixedTable() {
7474
});
7575
}
7676

77-
EventHandler.on(window, 'load.uds.fixed-table', initializeFixedTable);
77+
EventHandler.on(window, 'load.uds.fixed-table', initFixedTable);
7878

79-
export { initializeFixedTable };
79+
export { initFixedTable };
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
import { initAnchorMenu } from "./anchor-menu.js";
21
// import Banner from "./banner.js";
2+
import { initAnchorMenu } from "./anchor-menu.js";
33
import { initBlockquoteAnimation } from "./blockquote-animated.js";
44
import { initCalendar } from "./calendar.js";
5-
import { rankingFunc } from "./card-ranking.js";
5+
import { initRankingCard } from "./card-ranking.js";
66
import { initChart } from "./charts-and-graphs.js";
77
import { initDataLayer } from "./data-layer.js";
88
import { initGlobalHeader } from "./global-header.js";
99
import { initHeroesVideo } from "./heroes-video.js";
1010
import { initImageParallax } from "./image-parallax.js";
1111
import { initModals } from "./modals.js";
12-
import { initTabs } from "./tabbed-panels.js";
13-
import { initializeFixedTable } from "./tables.js";
12+
import { initTabbedPanels } from "./tabbed-panels.js";
13+
import { initFixedTable } from "./tables.js";
1414
import { initVideo } from "./video.js";
1515

1616
const unityBootstrap = {
17+
// Banner, // code updated to use bootstrap alert so we don't need this
1718
initAnchorMenu,
18-
// Banner,
1919
initBlockquoteAnimation,
2020
initCalendar,
21-
rankingFunc,
2221
initChart,
2322
initDataLayer,
23+
initFixedTable,
2424
initGlobalHeader,
2525
initHeroesVideo,
2626
initImageParallax,
2727
initModals,
28-
initializeFixedTable,
28+
initRankingCard,
29+
initTabbedPanels,
2930
initVideo,
30-
initTabs,
3131
}
3232

3333
export default unityBootstrap;

packages/unity-bootstrap-theme/stories/atoms/anchor-menu/anchor-menu.examples.stories.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,13 @@ import React from "react";
33
import { imageName } from "../../../../../shared/assets";
44
import { htmlRootDecorator } from "../../../../../shared/components/Layout";
55
import {getLoremSentences} from "../../../../../shared/constants/strings";
6+
67
export default {
78
title: "Atoms/Anchor Menu",
89
parameters: {
10+
initFunc: {
11+
disable: false,
12+
},
913
header: {
1014
forced: true,
1115
},

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,11 @@ export const BlockquoteAnimated = () => (
219219

220220
</>
221221
);
222-
222+
BlockquoteAnimated.parameters = {
223+
initFunc: {
224+
disable: false,
225+
},
226+
};
223227
export const TestimonialsNoImage = () => (
224228
<>
225229
<div className="uds-blockquote uds-testimonial accent-gold uds-content-align">

0 commit comments

Comments
 (0)