@daeryun/dr_components 0.2.36 → 0.2.37

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@daeryun/dr_components",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- import { IHeaderType } from '../../types/header';
3
- declare const Header: ({ tel, setTel, footerTel, setFooterTel, logo, logo_w, routes, keywordArr, categoryType, doNotWrite, name, isBrochureBtn, isMedical }: IHeaderType) => React.JSX.Element;
4
- export default Header;
@@ -1,189 +0,0 @@
1
- import React, { useEffect, useState, useRef, useCallback } from 'react';
2
- import Image from 'next/image';
3
- import { useRouter } from 'next/router';
4
- import Menu from './Menu';
5
- import { insert } from '../../lib';
6
- import { savePowerLinkConversion, saveTelNumber } from '../../lib';
7
- import Link from 'next/link';
8
- import * as gtag from '../../lib/gtag';
9
- import { removeScrollPos } from '../hook/useScrollRestoration';
10
- import Wrapper from '../Layout/Wrapper';
11
- import Call from '../../asset/images/header/h_call_line.webp';
12
- import Call_b from '../../asset/images/header/h_call_line_b.webp';
13
- import H_menu from '../../asset/images/header/h_menu.webp';
14
- import H_menu_b from '../../asset/images/header/h_menu_b.webp';
15
- const Header = ({ tel, setTel, footerTel, setFooterTel, logo, logo_w, routes, keywordArr, categoryType, doNotWrite, name, isBrochureBtn, isMedical }) => {
16
- const router = useRouter();
17
- const mobile = require('is-mobile');
18
- const [isTop, setIsTop] = useState(true);
19
- const [isMain, setIsMain] = useState(true);
20
- const [isMobile, setIsMobile] = useState(false);
21
- const [opacity, setOpacity] = useState(0);
22
- const [menuToggle, setMenuToggle] = useState(false);
23
- const timeoutRef = useRef();
24
- const headerRef = useRef(null);
25
- const setNaverLinkTel = () => {
26
- setTel('1660-1043');
27
- setFooterTel('1660 - 1043');
28
- };
29
- const setGoogleLinkTel = () => {
30
- setTel('1660-1028');
31
- setFooterTel('1660 - 1028');
32
- };
33
- const setResetTel = () => {
34
- setTel(tel);
35
- setFooterTel(footerTel);
36
- };
37
- const setYoutubeTel = () => {
38
- setTel('02-6958-6578');
39
- setFooterTel('02 - 6958 - 6578');
40
- };
41
- useEffect(() => {
42
- const is_mobile = mobile();
43
- saveTelNumber(is_mobile, setNaverLinkTel, setGoogleLinkTel, setYoutubeTel, setResetTel);
44
- }, []);
45
- const handleScroll = useCallback(() => {
46
- const scrollElm = document.scrollingElement;
47
- if (scrollElm !== null) {
48
- const scrollTop = Math.max(scrollElm.scrollTop, document.body.scrollTop);
49
- if (scrollTop > 0) {
50
- setIsTop(false);
51
- }
52
- else {
53
- setIsTop(true);
54
- }
55
- }
56
- }, []);
57
- const topTelClick = () => {
58
- gtag.event({
59
- action: 'mobile_toptel',
60
- category: 'toptel',
61
- label: '모바일상단전화버튼',
62
- value: '1'
63
- });
64
- };
65
- const ace_ToptelClick = () => {
66
- try {
67
- // @ts-ignore
68
- AM_PL('/m_Toptel');
69
- }
70
- catch (e) { }
71
- };
72
- const handleMenuToggle = useCallback((url) => {
73
- if (!menuToggle) {
74
- timeoutRef.current = setInterval(() => {
75
- setOpacity(prev => prev + 0.2);
76
- }, 40);
77
- }
78
- else {
79
- setOpacity(0);
80
- clearInterval(timeoutRef.current);
81
- }
82
- setMenuToggle(prev => !prev);
83
- if (url) {
84
- removeScrollPos(url);
85
- }
86
- }, [menuToggle]);
87
- const handleKeyPress = (e) => {
88
- if (e.key === 'Enter') {
89
- handleMenuToggle();
90
- }
91
- };
92
- useEffect(() => {
93
- const isRootPath = router.pathname === '/';
94
- const isStrengthPath = router.pathname === '/strength';
95
- const isIntroPath = router.pathname === '/intro';
96
- const conditionMap = {
97
- main: [isRootPath, isStrengthPath],
98
- divorce: [(isRootPath || isStrengthPath) && !doNotWrite],
99
- assault: [(isRootPath || isStrengthPath) && !doNotWrite],
100
- medical: [(isRootPath || isStrengthPath) && !doNotWrite],
101
- detective: [isRootPath, isIntroPath],
102
- labor: [isRootPath, isIntroPath],
103
- trade: [isRootPath, isIntroPath],
104
- comp: [isRootPath, isStrengthPath, router.pathname === '/advice', router.pathname === '/management'],
105
- school: [isRootPath],
106
- discovery: [isRootPath],
107
- tax: [isRootPath],
108
- inherit: [isRootPath],
109
- estate: [isStrengthPath],
110
- military: [isStrengthPath],
111
- accounting: [isRootPath && !doNotWrite],
112
- traffic: [isRootPath, isStrengthPath, isIntroPath],
113
- consulting: [isStrengthPath],
114
- entertainment: [isRootPath && !doNotWrite]
115
- };
116
- const checkCondition = () => {
117
- const conditions = conditionMap[name];
118
- return conditions ? conditions.some(Boolean) : false;
119
- };
120
- if (checkCondition()) {
121
- setIsTop(true);
122
- setIsMain(true);
123
- document.addEventListener('scroll', handleScroll);
124
- return () => {
125
- document.removeEventListener('scroll', handleScroll);
126
- };
127
- }
128
- else {
129
- setIsMain(true);
130
- setIsTop(false);
131
- }
132
- }, [handleScroll, router.pathname]);
133
- useEffect(() => {
134
- setIsMobile(mobile());
135
- }, []);
136
- useEffect(() => {
137
- const pathsToExclude = {
138
- mainStrength: ['/', '/strength'],
139
- strength: ['/strength'],
140
- mainIntro: ['/', '/intro'],
141
- introStrength: ['/', '/strength', '/intro'],
142
- main: ['/']
143
- };
144
- const shouldSetStates =
145
- //@ts-ignore
146
- categoryType in pathsToExclude && !pathsToExclude[categoryType].includes(router.pathname);
147
- if (shouldSetStates) {
148
- setIsTop(false);
149
- setIsMain(false);
150
- }
151
- }, [router.pathname, categoryType]);
152
- useEffect(() => {
153
- if (opacity > 1) {
154
- clearInterval(timeoutRef.current);
155
- }
156
- }, [opacity]);
157
- return (<>
158
- <header ref={headerRef} className={'fixed top-0 z-[3000] h-[90px] w-full bg-white font-[SUIT] max-md2:h-[80px] max-md:h-[70px] ' +
159
- (isMain
160
- ? isTop
161
- ? ' bg-opacity-0 '
162
- : ' bg-opacity-90 shadow-sm'
163
- : 'border-b-[2px] border-solid border-[#e5e7eb] bg-opacity-100')}>
164
- <Wrapper className={'flex h-full items-center justify-between'}>
165
- <Link href={`/`} className={'block'}>
166
- <Image src={isTop ? logo_w : logo} alt={`${process.env.NEXT_PUBLIC_KEYWORD}전문변호사 로고`} width={348} height={70} priority property={'eager'} className={'h-[36px] w-auto max-md2:h-[32px] max-md:h-[28px]'}/>
167
- </Link>
168
-
169
- <div className={'flex h-full items-center'}>
170
- <Link href={`tel:${tel}`} onClick={() => {
171
- insert('call', isMobile);
172
- savePowerLinkConversion('call', isMobile);
173
- topTelClick();
174
- ace_ToptelClick();
175
- }} aria-label={'tel'} className={'flex items-center gap-[18px] text-[20px] font-[800] leading-none tracking-[-0.4px] max-md2:gap-[10px] max-md2:text-[18px] max-md:text-[16px] max-xs:hidden ' +
176
- (isTop ? 'text-white' : '')}>
177
- <Image src={isTop ? Call : Call_b} alt={'tel'} width={76} height={76} className={'h-[38px] w-[38px] max-md2:h-[36px] max-md2:w-[36px] max-md:h-[32px] max-md:w-[32px] '}/>
178
- {tel}
179
- </Link>
180
-
181
- <Menu menuToggle={menuToggle} handleMenuToggle={handleMenuToggle} opacity={opacity} routes={routes} tel={tel} logo={logo} keywordArr={keywordArr} isBrochureBtn={isBrochureBtn} isMedical={isMedical}/>
182
-
183
- {!menuToggle && (<Image onKeyDown={handleKeyPress} tabIndex={0} src={isTop ? H_menu : H_menu_b} alt="메뉴바" width={38} height={17} className={'z-10 ml-[40px] h-auto w-[28px] cursor-pointer max-md2:w-[25px] max-md:ml-[30px] max-md:w-[22px]'} onClick={() => handleMenuToggle()}/>)}
184
- </div>
185
- </Wrapper>
186
- </header>
187
- </>);
188
- };
189
- export default Header;
@@ -1,8 +0,0 @@
1
- import Header from './Header';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
- import '../../styles/globals.css';
4
- import '../../styles/font_style.css';
5
- declare const meta: Meta<typeof Header>;
6
- export default meta;
7
- type Story = StoryObj<typeof meta>;
8
- export declare const Default: Story;
@@ -1,200 +0,0 @@
1
- import Header from './Header';
2
- import '../../styles/globals.css';
3
- import '../../styles/font_style.css';
4
- import { atom } from 'recoil';
5
- import Logo from '../../asset/images/header/logo_b.webp';
6
- import Logo_w from '../../asset/images/header/logo_w.webp';
7
- import { useState } from 'react';
8
- const meta = {
9
- component: Header,
10
- title: 'Header'
11
- };
12
- export default meta;
13
- const footerTelAtom = atom({
14
- key: 'footer-tel',
15
- default: '1660 - 1807'
16
- });
17
- export const Default = {
18
- render: args => {
19
- const [footerTel, setFooterTel] = useState('');
20
- return (<div className={'h-[800px] w-full bg-gray-200'}>
21
- <Header {...args} setFooterTel={setFooterTel}/>
22
- <span className={'block pt-40'}> {footerTel}</span>
23
- </div>);
24
- },
25
- args: {
26
- setTel: () => { },
27
- setFooterTel: () => { },
28
- tel: '1800-7905',
29
- logo: Logo,
30
- logo_w: Logo_w,
31
- categoryType: 'mainStrength',
32
- keywordArr: ['보이스피싱', '성범죄', '교통사고', '음주운전', '학교폭력', '마약', '명예훼손', '중대재해'],
33
- name: 'detective',
34
- routes: [
35
- {
36
- path: '/greeting',
37
- name: '그룹소개',
38
- routes: [
39
- {
40
- path: '/greeting',
41
- name: '비전',
42
- ename: 'VISION'
43
- },
44
- {
45
- path: '/strength',
46
- name: '대륜의 강점',
47
- ename: 'String point'
48
- },
49
- {
50
- path: '/map',
51
- name: '오시는 길',
52
- ename: 'Locations'
53
- },
54
- {
55
- path: 'https://www.daeryunlaw.com/integrate?search=&tab=전체',
56
- name: '통합검색',
57
- ename: 'Search entire site'
58
- }
59
- ]
60
- },
61
- {
62
- path: '/success?page=1',
63
- name: '업무사례',
64
- routes: [
65
- {
66
- path: '/success?page=1&search=',
67
- name: '업무사례',
68
- ename: 'Deals & Cases'
69
- },
70
- {
71
- path: 'https://www.daeryunlaw.com/trend',
72
- name: '판결분석',
73
- ename: 'Class action'
74
- },
75
- {
76
- path: '/info',
77
- name: '법률정보',
78
- ename: 'LawInfo'
79
- },
80
- {
81
- path: 'https://www.daeryunlaw.com/webtoon',
82
- name: '만화로 보는 사례',
83
- ename: 'Cartoon cases'
84
- },
85
- {
86
- path: '/reply',
87
- name: '고객후기',
88
- ename: "Client's reviews"
89
- }
90
- ]
91
- },
92
- {
93
- path: '/field/area',
94
- name: '업무분야',
95
- routes: [
96
- {
97
- path: '/field/area',
98
- name: '형사그룹 업무',
99
- ename: 'Practices'
100
- },
101
- {
102
- path: '/field/areaAll',
103
- name: '전체',
104
- ename: 'All'
105
- }
106
- ]
107
- },
108
- {
109
- path: '/lawyer?pro=false&page=1&search=',
110
- name: '구성원 소개',
111
- routes: [
112
- {
113
- path: '/lawyer?pro=false&page=1&search=',
114
- name: '형사그룹 전문변호사',
115
- ename: 'Attorneys'
116
- },
117
- {
118
- path: '/lawyer?pro=true&page=1&search=',
119
- name: '특수분야전문가',
120
- ename: 'Specialists'
121
- }
122
- ]
123
- },
124
- {
125
- path: '/broadcast',
126
- name: '소식/자료',
127
- routes: [
128
- {
129
- path: 'https://www.daeryunlaw.com/broadcast',
130
- name: '언론보도',
131
- ename: 'News'
132
- },
133
- {
134
- path: '/notice',
135
- name: '공지사항',
136
- ename: 'Notices'
137
- },
138
- {
139
- path: '/archive',
140
- name: '법률서식',
141
- ename: 'Archive'
142
- },
143
- {
144
- path: 'https://career.daeryunlaw.com',
145
- name: '인재채용',
146
- ename: 'Career'
147
- }
148
- ]
149
- },
150
- {
151
- path: '/youtube?search=&page=1',
152
- name: 'SNS',
153
- routes: [
154
- {
155
- path: '/youtube?search=&page=1',
156
- name: '유튜브',
157
- ename: 'Youtube'
158
- },
159
- {
160
- path: '/blog',
161
- name: '블로그',
162
- ename: 'Blog'
163
- },
164
- {
165
- path: '/instagram?page=1',
166
- name: '인스타그램',
167
- ename: 'Instagram'
168
- },
169
- {
170
- path: '/kin?page=1',
171
- name: '법률지식인',
172
- ename: 'Legal Expert'
173
- }
174
- ]
175
- },
176
- {
177
- path: 'https://www.scourt.go.kr/portal/information/events/search/search.jsp',
178
- name: '나의 사건검색',
179
- routes: [
180
- {
181
- path: 'https://www.scourt.go.kr/portal/information/events/search/search.jsp',
182
- name: '나의 사건검색',
183
- ename: 'Find my cases'
184
- }
185
- ]
186
- },
187
- {
188
- path: '/choice',
189
- name: '대륜법률상담예약',
190
- routes: [
191
- {
192
- path: '/choice',
193
- name: '대륜법률상담예약',
194
- ename: 'Request a counseling'
195
- }
196
- ]
197
- }
198
- ]
199
- }
200
- };
@@ -1,209 +0,0 @@
1
- import Header from './Header';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
- import '../../styles/globals.css';
4
- import '../../styles/font_style.css';
5
- import { useRecoilState, RecoilRoot, atom } from 'recoil';
6
- import Logo from '../../asset/images/header/logo_b.webp';
7
- import Logo_w from '../../asset/images/header/logo_w.webp';
8
- import { useState } from 'react';
9
-
10
- const meta: Meta<typeof Header> = {
11
- component: Header,
12
- title: 'Header'
13
- };
14
-
15
- export default meta;
16
-
17
- type Story = StoryObj<typeof meta>;
18
-
19
- const footerTelAtom = atom({
20
- key: 'footer-tel',
21
- default: '1660 - 1807'
22
- });
23
-
24
- export const Default: Story = {
25
- render: args => {
26
- const [footerTel, setFooterTel] = useState('');
27
- return (
28
- <div className={'h-[800px] w-full bg-gray-200'}>
29
- <Header {...args} setFooterTel={setFooterTel} />
30
- <span className={'block pt-40'}> {footerTel}</span>
31
- </div>
32
- );
33
- },
34
- args: {
35
- setTel: () => {},
36
- setFooterTel: () => {},
37
- tel: '1800-7905',
38
- logo: Logo,
39
- logo_w: Logo_w,
40
- categoryType: 'mainStrength',
41
- keywordArr: ['보이스피싱', '성범죄', '교통사고', '음주운전', '학교폭력', '마약', '명예훼손', '중대재해'],
42
- name: 'detective',
43
- routes: [
44
- {
45
- path: '/greeting',
46
- name: '그룹소개',
47
- routes: [
48
- {
49
- path: '/greeting',
50
- name: '비전',
51
- ename: 'VISION'
52
- },
53
- {
54
- path: '/strength',
55
- name: '대륜의 강점',
56
- ename: 'String point'
57
- },
58
- {
59
- path: '/map',
60
- name: '오시는 길',
61
- ename: 'Locations'
62
- },
63
- {
64
- path: 'https://www.daeryunlaw.com/integrate?search=&tab=전체',
65
- name: '통합검색',
66
- ename: 'Search entire site'
67
- }
68
- ]
69
- },
70
- {
71
- path: '/success?page=1',
72
- name: '업무사례',
73
- routes: [
74
- {
75
- path: '/success?page=1&search=',
76
- name: '업무사례',
77
- ename: 'Deals & Cases'
78
- },
79
- {
80
- path: 'https://www.daeryunlaw.com/trend',
81
- name: '판결분석',
82
- ename: 'Class action'
83
- },
84
- {
85
- path: '/info',
86
- name: '법률정보',
87
- ename: 'LawInfo'
88
- },
89
- {
90
- path: 'https://www.daeryunlaw.com/webtoon',
91
- name: '만화로 보는 사례',
92
- ename: 'Cartoon cases'
93
- },
94
- {
95
- path: '/reply',
96
- name: '고객후기',
97
- ename: "Client's reviews"
98
- }
99
- ]
100
- },
101
- {
102
- path: '/field/area',
103
- name: '업무분야',
104
- routes: [
105
- {
106
- path: '/field/area',
107
- name: '형사그룹 업무',
108
- ename: 'Practices'
109
- },
110
- {
111
- path: '/field/areaAll',
112
- name: '전체',
113
- ename: 'All'
114
- }
115
- ]
116
- },
117
- {
118
- path: '/lawyer?pro=false&page=1&search=',
119
- name: '구성원 소개',
120
- routes: [
121
- {
122
- path: '/lawyer?pro=false&page=1&search=',
123
- name: '형사그룹 전문변호사',
124
- ename: 'Attorneys'
125
- },
126
- {
127
- path: '/lawyer?pro=true&page=1&search=',
128
- name: '특수분야전문가',
129
- ename: 'Specialists'
130
- }
131
- ]
132
- },
133
- {
134
- path: '/broadcast',
135
- name: '소식/자료',
136
- routes: [
137
- {
138
- path: 'https://www.daeryunlaw.com/broadcast',
139
- name: '언론보도',
140
- ename: 'News'
141
- },
142
- {
143
- path: '/notice',
144
- name: '공지사항',
145
- ename: 'Notices'
146
- },
147
- {
148
- path: '/archive',
149
- name: '법률서식',
150
- ename: 'Archive'
151
- },
152
- {
153
- path: 'https://career.daeryunlaw.com',
154
- name: '인재채용',
155
- ename: 'Career'
156
- }
157
- ]
158
- },
159
- {
160
- path: '/youtube?search=&page=1',
161
- name: 'SNS',
162
- routes: [
163
- {
164
- path: '/youtube?search=&page=1',
165
- name: '유튜브',
166
- ename: 'Youtube'
167
- },
168
- {
169
- path: '/blog',
170
- name: '블로그',
171
- ename: 'Blog'
172
- },
173
- {
174
- path: '/instagram?page=1',
175
- name: '인스타그램',
176
- ename: 'Instagram'
177
- },
178
- {
179
- path: '/kin?page=1',
180
- name: '법률지식인',
181
- ename: 'Legal Expert'
182
- }
183
- ]
184
- },
185
- {
186
- path: 'https://www.scourt.go.kr/portal/information/events/search/search.jsp',
187
- name: '나의 사건검색',
188
- routes: [
189
- {
190
- path: 'https://www.scourt.go.kr/portal/information/events/search/search.jsp',
191
- name: '나의 사건검색',
192
- ename: 'Find my cases'
193
- }
194
- ]
195
- },
196
- {
197
- path: '/choice',
198
- name: '대륜법률상담예약',
199
- routes: [
200
- {
201
- path: '/choice',
202
- name: '대륜법률상담예약',
203
- ename: 'Request a counseling'
204
- }
205
- ]
206
- }
207
- ]
208
- }
209
- };