Skip to content

Commit f7e1470

Browse files
kennethkalmerclaude
andcommitted
style: apply prettier formatting
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
1 parent 34d32cb commit f7e1470

File tree

5 files changed

+26
-22
lines changed

5 files changed

+26
-22
lines changed

src/core/Expander.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const Expander = ({
3434

3535
const showControls = useMemo(
3636
() => contentHeight >= heightThreshold,
37-
[contentHeight, heightThreshold]
37+
[contentHeight, heightThreshold],
3838
);
3939

4040
const height = useMemo(
@@ -44,7 +44,7 @@ const Expander = ({
4444
: expanded
4545
? contentHeight
4646
: heightThreshold,
47-
[contentHeight, heightThreshold, expanded]
47+
[contentHeight, heightThreshold, expanded],
4848
);
4949

5050
return (

src/core/Header.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,19 +226,20 @@ const Header: React.FC<HeaderProps> = ({
226226
const noticeElement = document.querySelector('[data-id="ui-notice"]');
227227

228228
if (!noticeElement) {
229-
console.warn('Header: Notice element not found');
229+
console.warn("Header: Notice element not found");
230230
return;
231231
}
232232

233233
let previousVisibility = noticeBannerVisible;
234234

235235
const handleScroll = () => {
236236
const scrollY = window.scrollY;
237-
const isNoticeHidden = noticeElement.classList.contains("ui-announcement-hidden");
237+
const isNoticeHidden = noticeElement.classList.contains(
238+
"ui-announcement-hidden",
239+
);
238240

239241
const shouldBeVisible =
240-
scrollY <= COLLAPSE_TRIGGER_DISTANCE &&
241-
!isNoticeHidden;
242+
scrollY <= COLLAPSE_TRIGGER_DISTANCE && !isNoticeHidden;
242243

243244
if (shouldBeVisible !== previousVisibility) {
244245
previousVisibility = shouldBeVisible;

src/core/hooks/use-content-height.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useState, useEffect, useRef, RefObject } from "react";
1111
*/
1212
export function useContentHeight(
1313
ref: RefObject<HTMLElement>,
14-
initialHeight = 0
14+
initialHeight = 0,
1515
): number {
1616
const [contentHeight, setContentHeight] = useState<number>(initialHeight);
1717
const observerRef = useRef<ResizeObserver | null>(null);

src/core/hooks/use-themed-scrollpoints.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe("useThemedScrollpoints", () => {
7676
expect.objectContaining({
7777
rootMargin: "-64px 0px 0px 0px",
7878
threshold: 0,
79-
})
79+
}),
8080
);
8181
});
8282

@@ -109,7 +109,7 @@ describe("useThemedScrollpoints", () => {
109109
renderHook(() => useThemedScrollpoints(scrollpoints));
110110

111111
expect(consoleWarn).toHaveBeenCalledWith(
112-
expect.stringContaining('Element with id "non-existent" not found')
112+
expect.stringContaining('Element with id "non-existent" not found'),
113113
);
114114

115115
consoleWarn.mockRestore();
@@ -133,7 +133,7 @@ describe("useThemedScrollpoints", () => {
133133
expect(mockObserve).toHaveBeenCalledTimes(1);
134134
expect(mockObserve).toHaveBeenCalledWith(elem);
135135
expect(consoleWarn).toHaveBeenCalledWith(
136-
expect.stringContaining('Element with id "missing" not found')
136+
expect.stringContaining('Element with id "missing" not found'),
137137
);
138138

139139
consoleWarn.mockRestore();
@@ -166,7 +166,7 @@ describe("useThemedScrollpoints", () => {
166166
isIntersecting: true,
167167
} as unknown as IntersectionObserverEntry,
168168
],
169-
{} as IntersectionObserver
169+
{} as IntersectionObserver,
170170
);
171171

172172
await waitFor(() => {
@@ -194,7 +194,7 @@ describe("useThemedScrollpoints", () => {
194194
isIntersecting: true,
195195
} as unknown as IntersectionObserverEntry,
196196
],
197-
{} as IntersectionObserver
197+
{} as IntersectionObserver,
198198
);
199199

200200
// Should not trigger re-render (className unchanged)
@@ -226,7 +226,7 @@ describe("useThemedScrollpoints", () => {
226226
isIntersecting: false,
227227
} as unknown as IntersectionObserverEntry,
228228
],
229-
{} as IntersectionObserver
229+
{} as IntersectionObserver,
230230
);
231231

232232
// Should remain unchanged
@@ -264,7 +264,7 @@ describe("useThemedScrollpoints", () => {
264264
isIntersecting: true,
265265
} as unknown as IntersectionObserverEntry,
266266
],
267-
{} as IntersectionObserver
267+
{} as IntersectionObserver,
268268
);
269269

270270
await waitFor(() => {
@@ -301,7 +301,7 @@ describe("useThemedScrollpoints", () => {
301301
initialProps: {
302302
scrollpoints: [{ id: "zone1", className: "theme-light" }],
303303
},
304-
}
304+
},
305305
);
306306

307307
expect(IntersectionObserver).toHaveBeenCalledTimes(1);
@@ -343,7 +343,7 @@ describe("useThemedScrollpoints", () => {
343343
isIntersecting: true,
344344
} as unknown as IntersectionObserverEntry,
345345
],
346-
{} as IntersectionObserver
346+
{} as IntersectionObserver,
347347
);
348348

349349
expect(rafSpy).toHaveBeenCalled();

src/core/hooks/use-themed-scrollpoints.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { ThemedScrollpoint } from "../Header/types";
44
const HEADER_HEIGHT = 64;
55

66
export function useThemedScrollpoints(
7-
scrollpoints: ThemedScrollpoint[]
7+
scrollpoints: ThemedScrollpoint[],
88
): string {
99
const [activeClassName, setActiveClassName] = useState<string>(
10-
scrollpoints.length > 0 ? scrollpoints[0].className : ""
10+
scrollpoints.length > 0 ? scrollpoints[0].className : "",
1111
);
1212

1313
const previousClassNameRef = useRef<string>(activeClassName);
@@ -24,10 +24,13 @@ export function useThemedScrollpoints(
2424
for (const entry of entries) {
2525
if (entry.isIntersecting) {
2626
const scrollpoint = scrollpoints.find(
27-
(sp) => sp.id === entry.target.id
27+
(sp) => sp.id === entry.target.id,
2828
);
2929

30-
if (scrollpoint && scrollpoint.className !== previousClassNameRef.current) {
30+
if (
31+
scrollpoint &&
32+
scrollpoint.className !== previousClassNameRef.current
33+
) {
3134
previousClassNameRef.current = scrollpoint.className;
3235
setActiveClassName(scrollpoint.className);
3336
return;
@@ -39,7 +42,7 @@ export function useThemedScrollpoints(
3942
{
4043
rootMargin: `-${HEADER_HEIGHT}px 0px 0px 0px`,
4144
threshold: 0,
42-
}
45+
},
4346
);
4447

4548
scrollpoints.forEach(({ id }) => {
@@ -48,7 +51,7 @@ export function useThemedScrollpoints(
4851
observerRef.current?.observe(element);
4952
} else {
5053
console.warn(
51-
`useThemedScrollpoints: Element with id "${id}" not found in DOM`
54+
`useThemedScrollpoints: Element with id "${id}" not found in DOM`,
5255
);
5356
}
5457
});

0 commit comments

Comments
 (0)