Skip to content

Commit b8ecdf2

Browse files
chore: fix various lint error
1 parent e10dc26 commit b8ecdf2

File tree

7 files changed

+34
-33
lines changed

7 files changed

+34
-33
lines changed

packages/shared/utils/scroll-helper.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
// @ts-check
22
export function adjustShrinkingElementIfAboveViewport(element) {
3-
if(element && typeof element.getBoundingClientRect === "function") {
4-
5-
const {bottom:inViewportHeight, top, } = element.getBoundingClientRect();
6-
const {offsetTop } = element;
7-
if(top < 0 && inViewportHeight > 0) {
3+
if (element && typeof element.getBoundingClientRect === "function") {
4+
const { bottom: inViewportHeight, top } = element.getBoundingClientRect();
5+
const { offsetTop } = element;
6+
if (top < 0 && inViewportHeight > 0) {
87
const savedStyle = element.style;
98
element.style = `${savedStyle};transition: height 0s !important; overflow:hidden; height:${inViewportHeight}px!important;max-height:${inViewportHeight}px!important`;
10-
window.scrollTo({behavior:"instant", top: offsetTop });
11-
setTimeout(()=>{
9+
window.scrollTo({ behavior: "instant", top: offsetTop });
10+
setTimeout(() => {
1211
element.style = savedStyle;
13-
window.scrollTo({behavior:"smooth", top: element.offsetTop - inViewportHeight/2 });
12+
window.scrollTo({
13+
behavior: "smooth",
14+
top: element.offsetTop - inViewportHeight / 2,
15+
});
1416
}, 50);
1517
}
1618
}

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
import { adjustShrinkingElementIfAboveViewport } from "@shared";
1+
import { adjustShrinkingElementIfAboveViewport } from "@asu/shared";
22

33
import { EventHandler } from "./bootstrap-helper";
44

55
function initCollapse() {
6-
function accordionClick({target}) {
6+
function accordionClick({ target }) {
77
const targetHref = target.getAttribute("href");
8-
if (target.getAttribute("data-bs-toggle") !== "collapse" || !targetHref || !targetHref.includes("#")) {
8+
if (
9+
target.getAttribute("data-bs-toggle") !== "collapse" ||
10+
!targetHref ||
11+
!targetHref.includes("#")
12+
) {
913
return; // Exit the function - not a collapse link
1014
}
1115

1216
/**
1317
* Find the first accordion that is currently collapsing or expanding
1418
* Function will determine if scroll adjustment is needed
1519
*/
16-
adjustShrinkingElementIfAboveViewport(document.querySelector(".collapsing"));
20+
adjustShrinkingElementIfAboveViewport(
21+
document.querySelector(".collapsing")
22+
);
1723
}
1824
EventHandler.on(document, "click.uds.collapse", accordionClick);
1925
}

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ export default {
77
parameters: { controls: { disable: true } },
88
};
99

10-
export const Default = () =>
11-
<Container>
12-
<Column>
13-
<a target="_parent" href="../../@asu/unity-react-core/index.html?path=/story/components-accordion--default">Accordion has moved to @asu/unity-react-core</a>
14-
15-
</Column>
16-
</Container>;
17-
10+
export const Default = () => (
11+
<Container>
12+
<Column>
13+
<a
14+
target="_parent"
15+
href="../../@asu/unity-react-core/index.html?path=/story/components-accordion--default"
16+
>
17+
Accordion has moved to @asu/unity-react-core
18+
</a>
19+
</Column>
20+
</Container>
21+
);

packages/unity-bootstrap-theme/vite.config.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,6 @@ const c = {
7979
server: {
8080
port: 9000,
8181
},
82-
resolve: {
83-
alias: [
84-
{
85-
find: "@asu/shared",
86-
replacement: resolve(__dirname, "../shared"),
87-
},
88-
],
89-
},
9082
};
9183

9284
export default defineConfig(c);

packages/unity-react-core/src/components/Accordion/Accordion.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import PropTypes from "prop-types";
33
import React, { useId, useRef, useState } from "react";
44

5-
import { adjustShrinkingElementIfAboveViewport } from "../../../../../shared";
5+
import { adjustShrinkingElementIfAboveViewport } from "@asu/shared";
66
import { accordionCardPropTypes } from "../../core/models/shared-prop-types";
77
import { AccordionCard } from "./AccordionCard/AccordionCard";
88

@@ -52,7 +52,6 @@ const Accordion = ({ cards, openedCard }) => {
5252
ref={element => {
5353
cardsRef.current[key] = element;
5454
}}
55-
// eslint-disable-next-line react/no-array-index-key
5655
key={key + 1}
5756
id={key + 1}
5857
parentId={parentId}

packages/unity-react-core/src/components/Accordion/Accordion.stories.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable no-plusplus */
21
/* eslint react/jsx-props-no-spreading: "off" */
32
import React from "react";
43

5-
import { getLoremSentences } from "../../../../../shared/constants/strings";
4+
import { getLoremSentences } from "@asu/shared";
65
import { Accordion } from "./Accordion";
76

87
export default {

packages/unity-react-core/src/components/Accordion/AccordionCard/AccordionCard.jsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ export const AccordionCard = forwardRef(
9292
>
9393
<div
9494
className="accordion-body"
95-
// eslint-disable-next-line react/no-danger
9695
dangerouslySetInnerHTML={sanitizeDangerousMarkup(
9796
item.content.body
9897
)}

0 commit comments

Comments
 (0)