Skip to content

Commit b0224ff

Browse files
author
신용준
committed
feat: watch windowWidth
1 parent b817856 commit b0224ff

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@shinyongjun/react-fullpage",
3-
"version": "1.8.3",
3+
"version": "1.8.4",
44
"main": "./dist/cjs/index.js",
55
"module": "./dist/esm/index.js",
66
"source": "./src/index.tsx",

package/src/components/FullpageContainer.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function FullpageContainer({
3737
const prevActiveIndex = usePrevious(activeIndex) as number; // 직전 activeIndex 값
3838
const [sectionCount, setSectionCount] = useState<number>(0); // section 총 갯수
3939
const [isLoaded, setIsLoaded] = useState(false);
40-
const { height: windowHeight } = useWindowSize();
40+
const { width: windowWidth, height: windowHeight } = useWindowSize();
4141

4242
const callbackBeforeChange = useCallback(() => {
4343
if (onBeforeChange) {
@@ -86,6 +86,7 @@ function FullpageContainer({
8686

8787
setTransformY(temp);
8888
}, [
89+
windowWidth,
8990
windowHeight,
9091
activeIndex,
9192
setActiveIndex,

package/src/components/FullpageScrollbar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function FullpageScrollbar({ contentsHeight, scrollY, sectionRef }: IProps) {
1818
const isMousePressed = useMousePressed(handler);
1919
const [handlerHeight, setHandlerHeight] = useState<number>(0);
2020
const [handlerTop, setHandlerTop] = useState<number>(0);
21-
const { height: windowHeight } = useWindowSize();
21+
const { width: windowWidth, height: windowHeight } = useWindowSize();
2222
const [pressMouseY, setPressMouseY] = useState<number>(0);
2323
const [pressScrollY, setPressScrollY] = useState<number>(0);
2424

@@ -53,6 +53,7 @@ function FullpageScrollbar({ contentsHeight, scrollY, sectionRef }: IProps) {
5353
}, [
5454
mouseY,
5555
pressMouseY,
56+
windowWidth,
5657
windowHeight,
5758
contentsHeight,
5859
pressScrollY,

test/src/components/FooterSection.tsx

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,48 @@ function FooterSection() {
66
className="footer-section"
77
style={{
88
width: '100%',
9-
height: '200px',
9+
height: 'auto',
1010
backgroundColor: 'black',
1111
color: 'white',
1212
}}
1313
>
14+
Footer Section Footer Section Footer Section Footer Section Footer Section
15+
Footer Section Footer Section Footer Section Footer Section Footer Section
16+
Footer Section Footer Section Footer Section Footer Section Footer Section
17+
Footer Section Footer Section Footer Section Footer Section Footer Section
18+
Footer Section Footer Section Footer Section Footer Section Footer Section
19+
Footer Section Footer Section Footer Section Footer Section Footer Section
20+
Footer Section Footer Section Footer Section Footer Section Footer Section
21+
Footer Section Footer Section Footer Section Footer Section Footer Section
22+
Footer Section Footer Section Footer Section Footer Section Footer Section
23+
Footer Section Footer Section Footer Section Footer Section Footer Section
24+
Footer Section Footer Section Footer Section Footer Section Footer Section
25+
Footer Section Footer Section Footer Section Footer Section Footer Section
26+
Footer Section Footer Section Footer Section Footer Section Footer Section
27+
Footer Section Footer Section Footer Section Footer Section Footer Section
28+
Footer Section Footer Section Footer Section Footer Section Footer Section
29+
Footer Section Footer Section Footer Section Footer Section Footer Section
30+
Footer Section Footer Section Footer Section Footer Section Footer Section
31+
Footer Section Footer Section Footer Section Footer Section Footer Section
32+
Footer Section Footer Section Footer Section Footer Section Footer Section
33+
Footer Section Footer Section Footer Section Footer Section Footer Section
34+
Footer Section Footer Section Footer Section Footer Section Footer Section
35+
Footer Section Footer Section Footer Section Footer Section Footer Section
36+
Footer Section Footer Section Footer Section Footer Section Footer Section
37+
Footer Section Footer Section Footer Section Footer Section Footer Section
38+
Footer Section Footer Section Footer Section Footer Section Footer Section
39+
Footer Section Footer Section Footer Section Footer Section Footer Section
40+
Footer Section Footer Section Footer Section Footer Section Footer Section
41+
Footer Section Footer Section Footer Section Footer Section Footer Section
42+
Footer Section Footer Section Footer Section Footer Section Footer Section
43+
Footer Section Footer Section Footer Section Footer Section Footer Section
44+
Footer Section Footer Section Footer Section Footer Section Footer Section
45+
Footer Section Footer Section Footer Section Footer Section Footer Section
46+
Footer Section Footer Section Footer Section Footer Section Footer Section
47+
Footer Section Footer Section Footer Section Footer Section Footer Section
48+
Footer Section Footer Section Footer Section Footer Section Footer Section
49+
Footer Section Footer Section Footer Section Footer Section Footer Section
50+
Footer Section Footer Section Footer Section Footer Section Footer Section
1451
Footer Section
1552
</footer>
1653
);

0 commit comments

Comments
 (0)