@xwadex/fesd-next 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/package.json +45 -0
- package/src/fesd/components/Anchors/Anchor.Controller.tsx +101 -0
- package/src/fesd/components/Anchors/Anchor.Offseter.tsx +36 -0
- package/src/fesd/components/Anchors/Anchor.Target.tsx +97 -0
- package/src/fesd/components/Anchors/Anchor.Wrapper.tsx +160 -0
- package/src/fesd/components/Anchors/Anchors.tsx +12 -0
- package/src/fesd/components/Anchors/index.ts +2 -0
- package/src/fesd/components/Articles/Article.Basic.tsx +49 -0
- package/src/fesd/components/Articles/Article.Figure.tsx +113 -0
- package/src/fesd/components/Articles/ArticleBasic.module.scss +62 -0
- package/src/fesd/components/Articles/ArticleFigure.module.scss +82 -0
- package/src/fesd/components/Articles/index.ts +2 -0
- package/src/fesd/components/Collapse/Collapse.Body.tsx +27 -0
- package/src/fesd/components/Collapse/Collapse.Container.tsx +56 -0
- package/src/fesd/components/Collapse/Collapse.Head.tsx +39 -0
- package/src/fesd/components/Collapse/Collapse.Wrapper.tsx +46 -0
- package/src/fesd/components/Collapse/Collapse.module.scss +23 -0
- package/src/fesd/components/Collapse/Collapse.tsx +11 -0
- package/src/fesd/components/Collapse/CollapseContext.tsx +21 -0
- package/src/fesd/components/Collapse/index.ts +1 -0
- package/src/fesd/components/Modals/Modals.module.scss +84 -0
- package/src/fesd/components/Modals/Modals.tsx +103 -0
- package/src/fesd/components/Modals/Modals.types.ts +52 -0
- package/src/fesd/components/Modals/index.ts +2 -0
- package/src/fesd/components/Overlay/Overlay.module.scss +14 -0
- package/src/fesd/components/Overlay/Overlay.tsx +50 -0
- package/src/fesd/components/Overlay/Overlay.types.ts +5 -0
- package/src/fesd/components/Overlay/index.ts +2 -0
- package/src/fesd/components/index.ts +5 -0
- package/src/fesd/hooks/index.ts +2 -0
- package/src/fesd/hooks/useAnchor4/Anchor4.ts +185 -0
- package/src/fesd/hooks/useAnchor4/index.ts +2 -0
- package/src/fesd/hooks/useAnchor4/useAnchor4.tsx +88 -0
- package/src/fesd/hooks/useDragScroll4.tsx +139 -0
- package/src/fesd/hooks/useTransitionend.tsx +3 -0
- package/src/fesd/methods/Easing4/Easing4.ts +374 -0
- package/src/fesd/methods/Easing4/index.ts +2 -0
- package/src/fesd/methods/index.ts +1 -0
- package/src/fesd/tools.ts +69 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/create-next-app).
|
|
2
|
+
|
|
3
|
+
## Getting Started
|
|
4
|
+
|
|
5
|
+
First, run the development server:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run dev
|
|
9
|
+
# or
|
|
10
|
+
yarn dev
|
|
11
|
+
# or
|
|
12
|
+
pnpm dev
|
|
13
|
+
# or
|
|
14
|
+
bun dev
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
18
|
+
|
|
19
|
+
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
|
20
|
+
|
|
21
|
+
## Learn More
|
|
22
|
+
|
|
23
|
+
To learn more about Next.js, take a look at the following resources:
|
|
24
|
+
|
|
25
|
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
26
|
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
27
|
+
|
|
28
|
+
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
|
29
|
+
|
|
30
|
+
## Deploy on Vercel
|
|
31
|
+
|
|
32
|
+
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
33
|
+
|
|
34
|
+
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
|
35
|
+
# fesd-test
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xwadex/fesd-next",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "./src/fesd",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "next dev --turbo",
|
|
9
|
+
"build": "next build",
|
|
10
|
+
"start": "next start",
|
|
11
|
+
"lint": "next lint"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"src/fesd"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@types/react": "npm:types-react@rc",
|
|
18
|
+
"@types/react-dom": "npm:types-react-dom@rc",
|
|
19
|
+
"ag-grid-community": "~31.3.1",
|
|
20
|
+
"ag-grid-enterprise": "~31.3.1",
|
|
21
|
+
"ag-grid-react": "~31.3.1",
|
|
22
|
+
"babel-plugin-react-compiler": "0.0.0-experimental-592953e-20240517",
|
|
23
|
+
"default-passive-events": "^2.0.0",
|
|
24
|
+
"eslint": "8.56.0",
|
|
25
|
+
"eslint-config-next": "14.1.0",
|
|
26
|
+
"framer-motion": "^11.0.15",
|
|
27
|
+
"next": "^15.0.0-canary.27",
|
|
28
|
+
"react": "19.0.0-rc-4c2e457c7c-20240522",
|
|
29
|
+
"react-dom": "19.0.0-rc-4c2e457c7c-20240522",
|
|
30
|
+
"react-icons": "^5.2.1",
|
|
31
|
+
"server-only": "^0.0.1",
|
|
32
|
+
"swiper": "^10.3.1",
|
|
33
|
+
"swr": "^2.2.5",
|
|
34
|
+
"tua-body-scroll-lock": "^1.4",
|
|
35
|
+
"typescript": "5.3.3",
|
|
36
|
+
"zustand": "^4.5.2"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@faker-js/faker": "^8.4.1",
|
|
40
|
+
"@types/body-scroll-lock": "^3.1.2",
|
|
41
|
+
"@types/node": "20.3.2",
|
|
42
|
+
"eslint-config-prettier": "^9.1.0",
|
|
43
|
+
"sass": "^1.70.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
+
/* 2024.06.10 */
|
|
3
|
+
"use client"
|
|
4
|
+
|
|
5
|
+
import { Fragment, useRef } from "react"
|
|
6
|
+
import { useAnchor4, useAnchor4Type } from "@/fesd/hooks"
|
|
7
|
+
import { useRouter } from "next/navigation"
|
|
8
|
+
|
|
9
|
+
interface PropsType extends
|
|
10
|
+
useAnchor4Type,
|
|
11
|
+
React.HTMLAttributes<HTMLElement> {
|
|
12
|
+
as?: React.ElementType
|
|
13
|
+
name: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const AnchorController: React.FC<PropsType> = (props) => {
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
children,
|
|
20
|
+
name,
|
|
21
|
+
as: RootComponent = "a",
|
|
22
|
+
hash: useHash = false,
|
|
23
|
+
href,
|
|
24
|
+
target,
|
|
25
|
+
scroller,
|
|
26
|
+
offseter,
|
|
27
|
+
history: useHistory = false,
|
|
28
|
+
offset = 0,
|
|
29
|
+
easing = "easeInOutExpo",
|
|
30
|
+
duration,
|
|
31
|
+
onceEvent = false,
|
|
32
|
+
center = false,
|
|
33
|
+
direction = "scrollTop",
|
|
34
|
+
onBeforeScroll,
|
|
35
|
+
onAfterScroll,
|
|
36
|
+
onScrolling,
|
|
37
|
+
debug,
|
|
38
|
+
delay,
|
|
39
|
+
...others
|
|
40
|
+
} = props
|
|
41
|
+
|
|
42
|
+
const options = {
|
|
43
|
+
hash: useHash,
|
|
44
|
+
target,
|
|
45
|
+
scroller,
|
|
46
|
+
offseter,
|
|
47
|
+
history: useHistory,
|
|
48
|
+
offset,
|
|
49
|
+
easing,
|
|
50
|
+
duration,
|
|
51
|
+
onceEvent,
|
|
52
|
+
center,
|
|
53
|
+
direction,
|
|
54
|
+
onBeforeScroll,
|
|
55
|
+
onAfterScroll,
|
|
56
|
+
onScrolling,
|
|
57
|
+
debug,
|
|
58
|
+
delay,
|
|
59
|
+
} as useAnchor4Type
|
|
60
|
+
|
|
61
|
+
const router = useRouter()
|
|
62
|
+
const linkRef = useRef<HTMLElement | null>(null)
|
|
63
|
+
|
|
64
|
+
const { scrolling, scrollToAnchor } = useAnchor4()
|
|
65
|
+
|
|
66
|
+
const targetHash = "#" + (target ?? "")
|
|
67
|
+
const targetURL = href ? href + targetHash : targetHash
|
|
68
|
+
|
|
69
|
+
const hashChangeHandler = (e?: MouseEvent) => {
|
|
70
|
+
if (history.scrollRestoration == "auto") history.scrollRestoration = "manual"
|
|
71
|
+
if (useHistory) return router.push(targetHash, { scroll: false })
|
|
72
|
+
history.replaceState(targetHash, "", targetHash)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
const onClickHandler = (e: MouseEvent) => {
|
|
76
|
+
e.preventDefault()
|
|
77
|
+
if (useHash) hashChangeHandler()
|
|
78
|
+
scrollToAnchor(options)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const rootProps = RootComponent == "a"
|
|
82
|
+
? { ...others, href: targetURL }
|
|
83
|
+
: { ...others }
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Fragment>
|
|
87
|
+
<RootComponent
|
|
88
|
+
{...rootProps}
|
|
89
|
+
ref={linkRef}
|
|
90
|
+
anchor-controller={name}
|
|
91
|
+
onClick={(e: MouseEvent) => onClickHandler(e)}
|
|
92
|
+
>{children}
|
|
93
|
+
</RootComponent>
|
|
94
|
+
</Fragment>
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
AnchorController.displayName = "AnchorController"
|
|
100
|
+
|
|
101
|
+
export default AnchorController
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* 2024.06.10 */
|
|
2
|
+
"use client"
|
|
3
|
+
|
|
4
|
+
import { Fragment } from 'react';
|
|
5
|
+
|
|
6
|
+
interface PropsType extends
|
|
7
|
+
React.HTMLAttributes<HTMLElement> {
|
|
8
|
+
as?: React.ElementType
|
|
9
|
+
name: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const AnchorOffseter: React.FC<PropsType> = (props) => {
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
children,
|
|
16
|
+
as: RootComponent = "div",
|
|
17
|
+
name: offsetTarget,
|
|
18
|
+
...others
|
|
19
|
+
} = props
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<Fragment>
|
|
23
|
+
<RootComponent
|
|
24
|
+
{...others}
|
|
25
|
+
anchor-offseter={offsetTarget}
|
|
26
|
+
>{children}
|
|
27
|
+
</RootComponent>
|
|
28
|
+
</Fragment>
|
|
29
|
+
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
AnchorOffseter.displayName = "AnchorOffseter"
|
|
35
|
+
|
|
36
|
+
export default AnchorOffseter
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
+
/* 2024.06.10 */
|
|
3
|
+
"use client"
|
|
4
|
+
|
|
5
|
+
import { useRef, Fragment, useEffect, useCallback } from 'react';
|
|
6
|
+
import { useAnchor4, useAnchor4Type } from '@/fesd/hooks';
|
|
7
|
+
|
|
8
|
+
interface PropsType extends
|
|
9
|
+
useAnchor4Type,
|
|
10
|
+
React.HTMLAttributes<HTMLElement> {
|
|
11
|
+
name: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface RefCurrentType extends React.RefObject<Element> {
|
|
15
|
+
anchor4: {
|
|
16
|
+
options?: useAnchor4Type
|
|
17
|
+
scroll?: () => void
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const AnchorTarget: React.FC<PropsType> = (props) => {
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
children,
|
|
25
|
+
as: RootComponent = "div",
|
|
26
|
+
name: target,
|
|
27
|
+
hash: useHash = false,
|
|
28
|
+
href,
|
|
29
|
+
scroller,
|
|
30
|
+
offseter,
|
|
31
|
+
history: useHistory = false,
|
|
32
|
+
offset = 0,
|
|
33
|
+
easing = "easeInOutExpo",
|
|
34
|
+
duration,
|
|
35
|
+
onceEvent = false,
|
|
36
|
+
center = false,
|
|
37
|
+
direction = "scrollTop",
|
|
38
|
+
onBeforeScroll,
|
|
39
|
+
onAfterScroll,
|
|
40
|
+
onScrolling,
|
|
41
|
+
debug,
|
|
42
|
+
delay,
|
|
43
|
+
...others
|
|
44
|
+
} = props
|
|
45
|
+
|
|
46
|
+
const options = {
|
|
47
|
+
hash: useHash,
|
|
48
|
+
href,
|
|
49
|
+
target,
|
|
50
|
+
scroller,
|
|
51
|
+
offseter,
|
|
52
|
+
history: useHistory,
|
|
53
|
+
offset,
|
|
54
|
+
easing,
|
|
55
|
+
duration,
|
|
56
|
+
onceEvent,
|
|
57
|
+
center,
|
|
58
|
+
direction,
|
|
59
|
+
onBeforeScroll,
|
|
60
|
+
onAfterScroll,
|
|
61
|
+
onScrolling,
|
|
62
|
+
debug,
|
|
63
|
+
delay,
|
|
64
|
+
} as useAnchor4Type
|
|
65
|
+
|
|
66
|
+
const targetRef = useRef<RefCurrentType | null>(null)
|
|
67
|
+
|
|
68
|
+
const { scrolling, scrollToAnchor } = useAnchor4()
|
|
69
|
+
|
|
70
|
+
const scrollToTatget = useCallback(() => {
|
|
71
|
+
scrollToAnchor(options)
|
|
72
|
+
}, [])
|
|
73
|
+
|
|
74
|
+
const refCurrentFunction = {
|
|
75
|
+
scroll: scrollToTatget,
|
|
76
|
+
options: options
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (targetRef.current) targetRef.current.anchor4 = refCurrentFunction
|
|
81
|
+
}, [scrolling])
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<Fragment>
|
|
85
|
+
<RootComponent
|
|
86
|
+
{...others}
|
|
87
|
+
ref={targetRef}
|
|
88
|
+
anchor-target={target}
|
|
89
|
+
>{children}
|
|
90
|
+
</RootComponent>
|
|
91
|
+
</Fragment>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
AnchorTarget.displayName = "AnchorTarget"
|
|
96
|
+
|
|
97
|
+
export default AnchorTarget
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
2
|
+
/* 2024.06.10 */
|
|
3
|
+
"use client"
|
|
4
|
+
|
|
5
|
+
import { useEffect, useRef } from "react"
|
|
6
|
+
import { useAnchor4, useAnchor4Type, useDragScroll4 } from "@/fesd/hooks"
|
|
7
|
+
import { off, on, delay as timeout } from "@/fesd/tools"
|
|
8
|
+
import { usePathname } from "next/navigation"
|
|
9
|
+
|
|
10
|
+
interface PropsType extends
|
|
11
|
+
useAnchor4Type,
|
|
12
|
+
React.HTMLAttributes<HTMLElement> {
|
|
13
|
+
name: string
|
|
14
|
+
dragScroller?: boolean,
|
|
15
|
+
listener?: "width" | "height"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const AnchorWrapper: React.FC<PropsType> = (props) => {
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
as: RootComponent = "div",
|
|
22
|
+
hash: useHash = false,
|
|
23
|
+
history: useHistory = false,
|
|
24
|
+
name,
|
|
25
|
+
scroller,
|
|
26
|
+
children,
|
|
27
|
+
offseter,
|
|
28
|
+
listener,
|
|
29
|
+
offset = 0,
|
|
30
|
+
easing = "easeInOutExpo",
|
|
31
|
+
duration,
|
|
32
|
+
onceEvent = false,
|
|
33
|
+
center = false,
|
|
34
|
+
direction = "scrollTop",
|
|
35
|
+
dragScroller = false,
|
|
36
|
+
onBeforeScroll,
|
|
37
|
+
onAfterScroll,
|
|
38
|
+
onScrolling,
|
|
39
|
+
debug,
|
|
40
|
+
delay,
|
|
41
|
+
...others
|
|
42
|
+
} = props
|
|
43
|
+
|
|
44
|
+
const options = {
|
|
45
|
+
hash: useHash,
|
|
46
|
+
offseter,
|
|
47
|
+
history: useHistory,
|
|
48
|
+
offset,
|
|
49
|
+
easing,
|
|
50
|
+
duration,
|
|
51
|
+
onceEvent,
|
|
52
|
+
center,
|
|
53
|
+
direction,
|
|
54
|
+
onBeforeScroll,
|
|
55
|
+
onAfterScroll,
|
|
56
|
+
onScrolling,
|
|
57
|
+
debug,
|
|
58
|
+
delay,
|
|
59
|
+
} as useAnchor4Type
|
|
60
|
+
|
|
61
|
+
const pathname = usePathname()
|
|
62
|
+
|
|
63
|
+
const { scrolling, scrollToAnchor, methods } = useAnchor4()
|
|
64
|
+
|
|
65
|
+
const wrapperRef = useRef<HTMLElement | null>(null)
|
|
66
|
+
|
|
67
|
+
const isBodyScroller = scroller == "body"
|
|
68
|
+
const size = listener == "width" ? "clientWidth" : "clientHeight"
|
|
69
|
+
const padding = listener == "width" ? "paddingLeft" : "paddingTop"
|
|
70
|
+
|
|
71
|
+
const onMountedChangeHash = async () => {
|
|
72
|
+
await timeout(500)
|
|
73
|
+
hashChangeCallback()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const hashChangeCallback = async (e?: MouseEvent) => {
|
|
77
|
+
console.log("wwwwwwww Wrapper hashChangeCallback");
|
|
78
|
+
if (e) e.stopPropagation()
|
|
79
|
+
const locationHash = window.location.hash
|
|
80
|
+
const target = locationHash ? locationHash.replace(/^#!?/, "") : undefined
|
|
81
|
+
scrollToAnchor({ ...options, target, scroller })
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const setScrollerAttr = (element: HTMLElement, offseter: string) => {
|
|
85
|
+
element.setAttribute("anchor-scroller", scroller)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const setScrollerListenerAttr = (element: HTMLElement, offseter: string) => {
|
|
89
|
+
element.setAttribute("anchor-listener", offseter)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const setScrollerPadding = (element: HTMLElement, value: number) =>
|
|
93
|
+
element.style[padding] = value == 0 ? "" : value + "px"
|
|
94
|
+
|
|
95
|
+
const resizeCallback = (entries: ResizeObserverEntry[]) => {
|
|
96
|
+
if (!entries.length) return
|
|
97
|
+
if (!wrapperRef.current) return
|
|
98
|
+
|
|
99
|
+
const resizeScroller = isBodyScroller
|
|
100
|
+
? document.body
|
|
101
|
+
: wrapperRef.current
|
|
102
|
+
|
|
103
|
+
setScrollerPadding(resizeScroller,
|
|
104
|
+
entries.reduce((value, entry) => value + entry.target?.[size] ?? 0, 0)
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// useDragScroll4({
|
|
109
|
+
// current: isBodyScroller
|
|
110
|
+
// ? document?.body
|
|
111
|
+
// : wrapperRef.current,
|
|
112
|
+
// active: dragScroller
|
|
113
|
+
// })
|
|
114
|
+
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (!useHash) return
|
|
117
|
+
|
|
118
|
+
onMountedChangeHash()
|
|
119
|
+
on("hashchange", hashChangeCallback);
|
|
120
|
+
return () => {
|
|
121
|
+
off("hashchange", hashChangeCallback);
|
|
122
|
+
}
|
|
123
|
+
}, [pathname]);
|
|
124
|
+
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (!wrapperRef.current) return
|
|
127
|
+
|
|
128
|
+
const scrollerElement = isBodyScroller ? document.body : wrapperRef.current
|
|
129
|
+
setScrollerAttr(scrollerElement, scroller)
|
|
130
|
+
|
|
131
|
+
if (!listener || !offseter) return
|
|
132
|
+
|
|
133
|
+
const { getOffseter } = methods
|
|
134
|
+
const resizeObserver = new ResizeObserver(resizeCallback)
|
|
135
|
+
const offsetElement = [...getOffseter(offseter)]
|
|
136
|
+
|
|
137
|
+
if (!offsetElement.length) return
|
|
138
|
+
|
|
139
|
+
for (let element of offsetElement) { element && resizeObserver.observe(element) }
|
|
140
|
+
setScrollerListenerAttr(scrollerElement, offseter)
|
|
141
|
+
|
|
142
|
+
return () => {
|
|
143
|
+
if (isBodyScroller) setScrollerPadding(document.body, 0)
|
|
144
|
+
if (resizeObserver) resizeObserver?.disconnect()
|
|
145
|
+
}
|
|
146
|
+
}, [])
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<RootComponent
|
|
150
|
+
{...others}
|
|
151
|
+
ref={wrapperRef}
|
|
152
|
+
anchor-wrapper={name}
|
|
153
|
+
>{children}
|
|
154
|
+
</RootComponent>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
AnchorWrapper.displayName = "AnchorWrapper"
|
|
159
|
+
|
|
160
|
+
export default AnchorWrapper
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* 2024.06.10 */
|
|
2
|
+
import AnchorTarget from "./Anchor.Target"
|
|
3
|
+
import AnchorWrapper from "./Anchor.Wrapper"
|
|
4
|
+
import AnchorOffseter from "./Anchor.Offseter"
|
|
5
|
+
import AnchorController from "./Anchor.Controller"
|
|
6
|
+
|
|
7
|
+
export const Anchors = Object.assign({}, {
|
|
8
|
+
Target: AnchorTarget,
|
|
9
|
+
Wrapper: AnchorWrapper,
|
|
10
|
+
Offseter: AnchorOffseter,
|
|
11
|
+
Controller: AnchorController
|
|
12
|
+
})
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* eslint-disable @next/next/no-img-element */
|
|
2
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
3
|
+
/* 2024.05.29 */
|
|
4
|
+
"use client"
|
|
5
|
+
|
|
6
|
+
import * as React from "react"
|
|
7
|
+
import style from "./ArticleBasic.module.scss"
|
|
8
|
+
|
|
9
|
+
interface PropsType extends
|
|
10
|
+
React.HTMLAttributes<HTMLElement> {
|
|
11
|
+
readonly css?: { [key: string]: string }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const ArticleBasic: React.FC<PropsType> = (props) => {
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
children,
|
|
18
|
+
css,
|
|
19
|
+
...others
|
|
20
|
+
} = props
|
|
21
|
+
|
|
22
|
+
const styles = css ? css : style
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<article className={styles.root}>
|
|
27
|
+
<section>
|
|
28
|
+
<figure>
|
|
29
|
+
<img src="./images/works_detail_06.png" alt="title" />
|
|
30
|
+
<figcaption>An elephant at sunset</figcaption>
|
|
31
|
+
</figure>
|
|
32
|
+
</section>
|
|
33
|
+
<section>
|
|
34
|
+
<hgroup>
|
|
35
|
+
<h3>Introducing the Zenith Pro X1</h3>
|
|
36
|
+
<p>Discover the future of mobile technology with the Zenith Pro X1, smartphone designed to elevate your digital experience, the Zenith Pro X1 combines cutting-edge.</p>
|
|
37
|
+
</hgroup>
|
|
38
|
+
<div>
|
|
39
|
+
<button>learn more</button>
|
|
40
|
+
</div>
|
|
41
|
+
</section>
|
|
42
|
+
</article>
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ArticleBasic.displayName = "ArticleBasic"
|
|
48
|
+
|
|
49
|
+
export default ArticleBasic
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/* eslint-disable @next/next/no-img-element */
|
|
2
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
3
|
+
/* 2024.05.29 */
|
|
4
|
+
"use client"
|
|
5
|
+
|
|
6
|
+
import * as React from "react"
|
|
7
|
+
import style from "./ArticleFigure.module.scss"
|
|
8
|
+
|
|
9
|
+
interface PropsType extends
|
|
10
|
+
React.HTMLAttributes<HTMLElement> {
|
|
11
|
+
readonly css?: { [key: string]: string }
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const Title4 = ({ style }: any) => {
|
|
15
|
+
return (
|
|
16
|
+
<hgroup>
|
|
17
|
+
<h3>Introducing the Zenith Pro X1</h3>
|
|
18
|
+
<h6>Introducing the Zenith Pro X1</h6>
|
|
19
|
+
</hgroup>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
const Content4 = ({ style }: any) => {
|
|
23
|
+
return (
|
|
24
|
+
<section className={style.content}>
|
|
25
|
+
<hgroup>
|
|
26
|
+
{/* <h3>Introducing the Zenith Pro X1</h3>
|
|
27
|
+
<h6>Introducing the Zenith Pro X1</h6> */}
|
|
28
|
+
<p>Discover the future of mobile technology with the Zenith Pro X1, smartphone designed to elevate your digital experience, the Zenith Pro X1 combines cutting-edge. Discover the future of mobile technology with the Zenith Pro X1, smartphone designed to elevate your digital experience, the Zenith Pro X1 combines cutting-edge.</p>
|
|
29
|
+
</hgroup>
|
|
30
|
+
<div>
|
|
31
|
+
<button>learn more</button>
|
|
32
|
+
</div>
|
|
33
|
+
</section>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
const Photos4 = ({ style }: any) => {
|
|
37
|
+
return (
|
|
38
|
+
<section className={style.photos}>
|
|
39
|
+
{/* <figure>
|
|
40
|
+
<img src="./images/works_detail_06.png" alt="title" />
|
|
41
|
+
<figcaption>An elephant at sunset</figcaption>
|
|
42
|
+
</figure>
|
|
43
|
+
<figure>
|
|
44
|
+
<img src="./images/works_detail_05.png" alt="title" />
|
|
45
|
+
<figcaption>An elephant at sunset</figcaption>
|
|
46
|
+
</figure>
|
|
47
|
+
<figure>
|
|
48
|
+
<img src="./images/works_detail_02.png" alt="title" />
|
|
49
|
+
<figcaption>An elephant at sunset</figcaption>
|
|
50
|
+
</figure> */}
|
|
51
|
+
<figure>
|
|
52
|
+
<img src="./images/works_detail_02.png" alt="title" />
|
|
53
|
+
<figcaption>An elephant at sunset</figcaption>
|
|
54
|
+
</figure>
|
|
55
|
+
<figure>
|
|
56
|
+
<img src="./images/works_detail_02.png" alt="title" />
|
|
57
|
+
<figcaption>An elephant at sunset</figcaption>
|
|
58
|
+
</figure>
|
|
59
|
+
<figure>
|
|
60
|
+
<img src="./images/works_detail_02.png" alt="title" />
|
|
61
|
+
<figcaption>An elephant at sunset</figcaption>
|
|
62
|
+
</figure>
|
|
63
|
+
<figure>
|
|
64
|
+
<img src="./images/works_detail_07.png" alt="title" />
|
|
65
|
+
<figcaption>An elephant at sunset</figcaption>
|
|
66
|
+
</figure>
|
|
67
|
+
</section>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
const ArticleFigure: React.FC<PropsType> = (props) => {
|
|
73
|
+
|
|
74
|
+
const {
|
|
75
|
+
children,
|
|
76
|
+
css,
|
|
77
|
+
...others
|
|
78
|
+
} = props
|
|
79
|
+
|
|
80
|
+
const [data, setData] = React.useState(["Title", "Photos", "Content"])
|
|
81
|
+
|
|
82
|
+
const Components = (name: string, key: number) => {
|
|
83
|
+
if (name == "Title") return <Title4 style={styles} key={key} />
|
|
84
|
+
if (name == "Photos") return <Photos4 style={styles} key={key} />
|
|
85
|
+
if (name == "Content") return <Content4 style={styles} key={key} />
|
|
86
|
+
return null
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const styles = css ? css : style
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<article
|
|
94
|
+
className={styles.root}
|
|
95
|
+
article-width="full"
|
|
96
|
+
article-type="normal"
|
|
97
|
+
>
|
|
98
|
+
{data && data.map((d: string, k: number) => Components(d, k))}
|
|
99
|
+
</article>
|
|
100
|
+
<article
|
|
101
|
+
className={styles.root}
|
|
102
|
+
article-type="normal"
|
|
103
|
+
>
|
|
104
|
+
{data && data.map((d: string, k: number) => Components(d, k))}
|
|
105
|
+
</article>
|
|
106
|
+
</>
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
ArticleFigure.displayName = "ArticleFigure"
|
|
112
|
+
|
|
113
|
+
export default ArticleFigure
|