@daeryun/dr_components 0.5.58 → 0.5.60

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.
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  type CategoryMenuType = {
3
3
  className?: string;
4
- url: string;
5
4
  };
6
- declare const CategoryMenuForPage: ({ className, url }: CategoryMenuType) => React.JSX.Element;
5
+ declare const CategoryMenuForPage: ({ className }: CategoryMenuType) => React.JSX.Element;
7
6
  export default CategoryMenuForPage;
@@ -4,24 +4,26 @@ import Link from 'next/link';
4
4
  import IconHome from '../../asset/images/categoryMenu/House.svg';
5
5
  import IconArrow from '../../asset/images/categoryMenu/right_arrow.svg';
6
6
  import { categoryMenuName } from '../../lib';
7
- const CategoryMenuForPage = ({ className = '', url }) => {
7
+ import { usePathname } from 'next/navigation';
8
+ const CategoryMenuForPage = ({ className = '' }) => {
9
+ const pathname = usePathname();
8
10
  const [menu, setMenu] = useState({
9
11
  title: '',
10
12
  subTitle: '',
11
13
  address: ''
12
14
  });
13
15
  useEffect(() => {
14
- setMenu(categoryMenuName({ url }));
15
- }, [url]);
16
+ setMenu(categoryMenuName({ url: pathname }));
17
+ }, [pathname]);
16
18
  const reloadUrl = (targetUrl) => {
17
- if (url === targetUrl) {
19
+ if (pathname === targetUrl) {
18
20
  window.location.href = targetUrl;
19
21
  }
20
22
  };
21
23
  return (<div className={'mr-0 flex gap-[3px] text-[16px] font-normal tracking-[-0.32px] max-md:text-[14px] max-3xs:text-[12px] ' +
22
24
  className} aria-label={'페이지 상단 네비게이션'}>
23
25
  <Link href="/public" tabIndex={0} id="daum-wm-content" className={'relative aspect-square w-[20px] max-md:w-[18px] '}>
24
- <IconHome className={'h-full w-full object-contain'}/>
26
+ <IconHome className={'w-fullobject-contain h-full'}/>
25
27
  </Link>
26
28
  {menu.title === menu.subTitle ? (<>
27
29
  <IconArrow className={'aspect-square w-[20px] scale-[-1] stroke-[#58595B] max-md:w-[18px] max-3xs:w-[16px]'}/>
@@ -5,13 +5,14 @@ import Link from 'next/link';
5
5
  import IconHome from '../../asset/images/categoryMenu/House.svg';
6
6
  import IconArrow from '../../asset/images/categoryMenu/right_arrow.svg';
7
7
  import { categoryMenuName } from '../../lib';
8
+ import { usePathname, useRouter } from 'next/navigation';
8
9
 
9
10
  type CategoryMenuType = {
10
11
  className?: string;
11
- url: string;
12
12
  };
13
13
 
14
- const CategoryMenuForPage = ({ className = '', url }: CategoryMenuType) => {
14
+ const CategoryMenuForPage = ({ className = '' }: CategoryMenuType) => {
15
+ const pathname = usePathname();
15
16
  const [menu, setMenu] = useState({
16
17
  title: '',
17
18
  subTitle: '',
@@ -19,11 +20,11 @@ const CategoryMenuForPage = ({ className = '', url }: CategoryMenuType) => {
19
20
  });
20
21
 
21
22
  useEffect(() => {
22
- setMenu(categoryMenuName({ url }));
23
- }, [url]);
23
+ setMenu(categoryMenuName({ url: pathname }));
24
+ }, [pathname]);
24
25
 
25
26
  const reloadUrl = (targetUrl: string) => {
26
- if (url === targetUrl) {
27
+ if (pathname === targetUrl) {
27
28
  window.location.href = targetUrl;
28
29
  }
29
30
  };
@@ -42,7 +43,7 @@ const CategoryMenuForPage = ({ className = '', url }: CategoryMenuType) => {
42
43
  id="daum-wm-content"
43
44
  className={'relative aspect-square w-[20px] max-md:w-[18px] '}
44
45
  >
45
- <IconHome className={'h-full w-full object-contain'} />
46
+ <IconHome className={'w-fullobject-contain h-full'} />
46
47
  </Link>
47
48
  {menu.title === menu.subTitle ? (
48
49
  <>
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- declare const MobileHeader: ({ isTextWhite, isBgOpacityZero, isBgShadow, isMain, isNotSubPage, handleMenuToggle, centerName }: {
2
+ declare const MobileHeader: ({ isTextWhite, isBgOpacityZero, isBgBorder, isBgShadow, isMain, isNotSubPage, handleMenuToggle, centerName }: {
3
3
  isNotSubPage?: boolean;
4
4
  isTextWhite: boolean;
5
5
  isMain: boolean;
6
+ isBgBorder: boolean;
6
7
  isBgShadow: boolean;
7
8
  isBgOpacityZero: boolean;
8
9
  handleMenuToggle: (url?: string | undefined) => void;
@@ -17,13 +17,12 @@ import SearchWhite from '../../asset/images/header/search_white.webp';
17
17
  import SearchBlack from '../../asset/images/header/search_black.webp';
18
18
  import MenuWhite from '../../asset/images/header/h_menu.webp';
19
19
  import MenuBlack from '../../asset/images/header/h_menu_b.webp';
20
- const MobileHeader = ({ isTextWhite, isBgOpacityZero, isBgShadow, isMain, isNotSubPage, handleMenuToggle, centerName }) => {
20
+ const MobileHeader = ({ isTextWhite, isBgOpacityZero, isBgBorder, isBgShadow, isMain, isNotSubPage, handleMenuToggle, centerName }) => {
21
21
  const router = useRouter();
22
- return (<header className={'relative h-[70px] w-full transition-colors duration-300 sm:hidden ' +
23
- (isBgOpacityZero ? 'opacity-0' : '') +
24
- (isBgShadow
25
- ? 'border-b-[2px] border-solid border-[#e5e7eb] bg-opacity-100'
26
- : ' bg-opacity-90 shadow-sm')}>
22
+ return (<header className={'relative h-[70px] w-full bg-white transition-colors duration-300 sm:hidden ' +
23
+ (isBgOpacityZero ? ' bg-opacity-0 ' : '') +
24
+ (isBgBorder ? ' border-b-[2px] border-solid border-[#e5e7eb] bg-opacity-100 ' : '') +
25
+ (isBgShadow ? ' bg-opacity-90 shadow-sm' : '')}>
27
26
  <HeaderWrapper className={'flex h-full w-full items-center justify-between'}>
28
27
  <Link href={`/`} className={'shrink-0'}>
29
28
  <Image src={`${process.env.NEXT_PUBLIC_S3_URL}/logo/${centerName}${isTextWhite ? '_w' : ''}.webp`} alt="법무법인(유한)대륜" width={216} priority height={33} className={'h-[25px] w-auto '}/>
@@ -10,11 +10,14 @@ export const Default = {
10
10
  render: args => {
11
11
  const queryClient = new QueryClient();
12
12
  return (<QueryClientProvider client={queryClient}>
13
- <MobileHeader {...args}/>
13
+ <div className={'relative h-[800px] w-full bg-red-200'}>
14
+ <MobileHeader {...args}/>
15
+ </div>
14
16
  </QueryClientProvider>);
15
17
  },
16
18
  args: {
17
19
  isTextWhite: true,
20
+ isBgBorder: false,
18
21
  isMain: true,
19
22
  isBgOpacityZero: false,
20
23
  isBgShadow: true,
@@ -17,12 +17,15 @@ export const Default: Story = {
17
17
  const queryClient = new QueryClient();
18
18
  return (
19
19
  <QueryClientProvider client={queryClient}>
20
- <MobileHeader {...args} />
20
+ <div className={'relative h-[800px] w-full bg-red-200'}>
21
+ <MobileHeader {...args} />
22
+ </div>
21
23
  </QueryClientProvider>
22
24
  );
23
25
  },
24
26
  args: {
25
27
  isTextWhite: true,
28
+ isBgBorder: false,
26
29
  isMain: true,
27
30
  isBgOpacityZero: false,
28
31
  isBgShadow: true,
@@ -14,6 +14,7 @@ import MenuBlack from '../../asset/images/header/h_menu_b.webp';
14
14
  const MobileHeader = ({
15
15
  isTextWhite,
16
16
  isBgOpacityZero,
17
+ isBgBorder,
17
18
  isBgShadow,
18
19
  isMain,
19
20
  isNotSubPage,
@@ -23,6 +24,7 @@ const MobileHeader = ({
23
24
  isNotSubPage?: boolean;
24
25
  isTextWhite: boolean;
25
26
  isMain: boolean;
27
+ isBgBorder: boolean;
26
28
  isBgShadow: boolean;
27
29
  isBgOpacityZero: boolean;
28
30
  handleMenuToggle: (url?: string | undefined) => void;
@@ -33,11 +35,10 @@ const MobileHeader = ({
33
35
  return (
34
36
  <header
35
37
  className={
36
- 'relative h-[70px] w-full transition-colors duration-300 sm:hidden ' +
37
- (isBgOpacityZero ? 'opacity-0' : '') +
38
- (isBgShadow
39
- ? 'border-b-[2px] border-solid border-[#e5e7eb] bg-opacity-100'
40
- : ' bg-opacity-90 shadow-sm')
38
+ 'relative h-[70px] w-full bg-white transition-colors duration-300 sm:hidden ' +
39
+ (isBgOpacityZero ? ' bg-opacity-0 ' : '') +
40
+ (isBgBorder ? ' border-b-[2px] border-solid border-[#e5e7eb] bg-opacity-100 ' : '') +
41
+ (isBgShadow ? ' bg-opacity-90 shadow-sm' : '')
41
42
  }
42
43
  >
43
44
  <HeaderWrapper className={'flex h-full w-full items-center justify-between'}>
@@ -5,7 +5,6 @@ interface PageTitleBoxProps {
5
5
  titleTxt: React.ReactNode;
6
6
  subTxt?: React.ReactNode;
7
7
  imgType: ImgType;
8
- url: string;
9
8
  }
10
- declare const PageTitleBox: ({ titleTxt, subTxt, imgType, url }: PageTitleBoxProps) => React.JSX.Element;
9
+ declare const PageTitleBox: ({ titleTxt, subTxt, imgType }: PageTitleBoxProps) => React.JSX.Element;
11
10
  export default PageTitleBox;
@@ -4,6 +4,8 @@ import Image from 'next/image';
4
4
  import PageWrapper from '../Layout/PageWrapper';
5
5
  import CategoryMenuForPage from '../CategoryMenu/CategoryMenuForPage';
6
6
  import SubPageTitle from '../SubPage/SubPageTitle';
7
+ import useBrowser from '../hook/useBrowser';
8
+ import { ImgTypes } from './ImgTypes';
7
9
  import archiveImg from '../../asset/images/PageTitleBox/archive.webp';
8
10
  import broadcastImg from '../../asset/images/PageTitleBox/broadcast.webp';
9
11
  import fieldImg from '../../asset/images/PageTitleBox/field.webp';
@@ -12,7 +14,14 @@ import noticeImg from '../../asset/images/PageTitleBox/notice.webp';
12
14
  import replyImg from '../../asset/images/PageTitleBox/reply.webp';
13
15
  import successImg from '../../asset/images/PageTitleBox/success.webp';
14
16
  import trendImg from '../../asset/images/PageTitleBox/trend.webp';
15
- import { ImgTypes } from './ImgTypes';
17
+ import archiveImgM from '../../asset/images/PageTitleBox/archive_m.webp';
18
+ import broadcastImgM from '../../asset/images/PageTitleBox/broadcast_m.webp';
19
+ import fieldImgM from '../../asset/images/PageTitleBox/field_m.webp';
20
+ import infoImgM from '../../asset/images/PageTitleBox/info_m.webp';
21
+ import noticeImgM from '../../asset/images/PageTitleBox/notice_m.webp';
22
+ import replyImgM from '../../asset/images/PageTitleBox/reply_m.webp';
23
+ import successImgM from '../../asset/images/PageTitleBox/success_m.webp';
24
+ import trendImgM from '../../asset/images/PageTitleBox/trend_m.webp';
16
25
  const imageMap = {
17
26
  [ImgTypes.ARCHIVE]: archiveImg,
18
27
  [ImgTypes.BROADCAST]: broadcastImg,
@@ -23,7 +32,18 @@ const imageMap = {
23
32
  [ImgTypes.SUCCESS]: successImg,
24
33
  [ImgTypes.TREND]: trendImg
25
34
  };
26
- const PageTitleBox = ({ titleTxt, subTxt, imgType, url }) => {
35
+ const imageMapMobile = {
36
+ [ImgTypes.ARCHIVE]: archiveImgM,
37
+ [ImgTypes.BROADCAST]: broadcastImgM,
38
+ [ImgTypes.FIELD]: fieldImgM,
39
+ [ImgTypes.INFO]: infoImgM,
40
+ [ImgTypes.NOTICE]: noticeImgM,
41
+ [ImgTypes.REPLY]: replyImgM,
42
+ [ImgTypes.SUCCESS]: successImgM,
43
+ [ImgTypes.TREND]: trendImgM
44
+ };
45
+ const PageTitleBox = ({ titleTxt, subTxt, imgType }) => {
46
+ const { width } = useBrowser(true);
27
47
  return (<div className={'relative mt-[120px] flex h-[300px] w-full flex-col items-start justify-center bg-gray-200 ' +
28
48
  //768px
29
49
  'max-md:h-[250px] ' +
@@ -31,9 +51,10 @@ const PageTitleBox = ({ titleTxt, subTxt, imgType, url }) => {
31
51
  'max-sm:mt-[68px] ' +
32
52
  //480px
33
53
  'max-xs:h-[200px] '}>
34
- <Image src={imageMap[imgType]} alt={''} fill sizes={'100vw'} className={'h-full w-full object-cover'} unoptimized draggable={false}/>
54
+ <Image src={imageMap[imgType]} alt={''} fill sizes={'100vw'} className={'h-full w-full object-cover max-sm:hidden'} unoptimized draggable={false}/>
55
+ <Image src={imageMapMobile[imgType]} alt={''} fill sizes={'100vw'} className={'h-full w-full object-cover sm:hidden'} unoptimized draggable={false}/>
35
56
  <PageWrapper className={'relative'}>
36
- <CategoryMenuForPage className={'mb-[26px] max-md:mb-[20px] max-xs:mb-[12px] '} url={url}/>
57
+ <CategoryMenuForPage className={'mb-[26px] max-md:mb-[20px] max-xs:mb-[12px] '}/>
37
58
  <SubPageTitle titleTxt={titleTxt} subTxt={subTxt}/>
38
59
  </PageWrapper>
39
60
  </div>);
@@ -14,7 +14,6 @@ export const Default = {
14
14
  args: {
15
15
  titleTxt: <>업무사례</>,
16
16
  subTxt: <>손해배상(기)</>,
17
- imgType: ImgTypes.ARCHIVE,
18
- url: ''
17
+ imgType: ImgTypes.ARCHIVE
19
18
  }
20
19
  };
@@ -21,7 +21,6 @@ export const Default: Story = {
21
21
  args: {
22
22
  titleTxt: <>업무사례</>,
23
23
  subTxt: <>손해배상(기)</>,
24
- imgType: ImgTypes.ARCHIVE,
25
- url: ''
24
+ imgType: ImgTypes.ARCHIVE
26
25
  }
27
26
  };
@@ -5,6 +5,8 @@ import Image, { StaticImageData } from 'next/image';
5
5
  import PageWrapper from '../Layout/PageWrapper';
6
6
  import CategoryMenuForPage from '../CategoryMenu/CategoryMenuForPage';
7
7
  import SubPageTitle from '../SubPage/SubPageTitle';
8
+ import useBrowser from '../hook/useBrowser';
9
+ import { ImgTypes } from './ImgTypes';
8
10
 
9
11
  import archiveImg from '../../asset/images/PageTitleBox/archive.webp';
10
12
  import broadcastImg from '../../asset/images/PageTitleBox/broadcast.webp';
@@ -14,7 +16,15 @@ import noticeImg from '../../asset/images/PageTitleBox/notice.webp';
14
16
  import replyImg from '../../asset/images/PageTitleBox/reply.webp';
15
17
  import successImg from '../../asset/images/PageTitleBox/success.webp';
16
18
  import trendImg from '../../asset/images/PageTitleBox/trend.webp';
17
- import { ImgTypes } from './ImgTypes';
19
+
20
+ import archiveImgM from '../../asset/images/PageTitleBox/archive_m.webp';
21
+ import broadcastImgM from '../../asset/images/PageTitleBox/broadcast_m.webp';
22
+ import fieldImgM from '../../asset/images/PageTitleBox/field_m.webp';
23
+ import infoImgM from '../../asset/images/PageTitleBox/info_m.webp';
24
+ import noticeImgM from '../../asset/images/PageTitleBox/notice_m.webp';
25
+ import replyImgM from '../../asset/images/PageTitleBox/reply_m.webp';
26
+ import successImgM from '../../asset/images/PageTitleBox/success_m.webp';
27
+ import trendImgM from '../../asset/images/PageTitleBox/trend_m.webp';
18
28
 
19
29
  export type ImgType = (typeof ImgTypes)[keyof typeof ImgTypes];
20
30
 
@@ -29,14 +39,25 @@ const imageMap: Record<ImgType, StaticImageData> = {
29
39
  [ImgTypes.TREND]: trendImg
30
40
  };
31
41
 
42
+ const imageMapMobile: Record<ImgType, StaticImageData> = {
43
+ [ImgTypes.ARCHIVE]: archiveImgM,
44
+ [ImgTypes.BROADCAST]: broadcastImgM,
45
+ [ImgTypes.FIELD]: fieldImgM,
46
+ [ImgTypes.INFO]: infoImgM,
47
+ [ImgTypes.NOTICE]: noticeImgM,
48
+ [ImgTypes.REPLY]: replyImgM,
49
+ [ImgTypes.SUCCESS]: successImgM,
50
+ [ImgTypes.TREND]: trendImgM
51
+ };
52
+
32
53
  interface PageTitleBoxProps {
33
54
  titleTxt: React.ReactNode;
34
55
  subTxt?: React.ReactNode;
35
56
  imgType: ImgType;
36
- url: string;
37
57
  }
38
58
 
39
- const PageTitleBox = ({ titleTxt, subTxt, imgType, url }: PageTitleBoxProps) => {
59
+ const PageTitleBox = ({ titleTxt, subTxt, imgType }: PageTitleBoxProps) => {
60
+ const { width } = useBrowser(true);
40
61
  return (
41
62
  <div
42
63
  className={
@@ -54,12 +75,21 @@ const PageTitleBox = ({ titleTxt, subTxt, imgType, url }: PageTitleBoxProps) =>
54
75
  alt={''}
55
76
  fill
56
77
  sizes={'100vw'}
57
- className={'h-full w-full object-cover'}
78
+ className={'h-full w-full object-cover max-sm:hidden'}
79
+ unoptimized
80
+ draggable={false}
81
+ />
82
+ <Image
83
+ src={imageMapMobile[imgType]}
84
+ alt={''}
85
+ fill
86
+ sizes={'100vw'}
87
+ className={'h-full w-full object-cover sm:hidden'}
58
88
  unoptimized
59
89
  draggable={false}
60
90
  />
61
91
  <PageWrapper className={'relative'}>
62
- <CategoryMenuForPage className={'mb-[26px] max-md:mb-[20px] max-xs:mb-[12px] '} url={url} />
92
+ <CategoryMenuForPage className={'mb-[26px] max-md:mb-[20px] max-xs:mb-[12px] '} />
63
93
  <SubPageTitle titleTxt={titleTxt} subTxt={subTxt} />
64
94
  </PageWrapper>
65
95
  </div>
@@ -2013,6 +2013,10 @@ video {
2013
2013
  height: 80%;
2014
2014
  }
2015
2015
 
2016
+ .h-\[800px\] {
2017
+ height: 800px;
2018
+ }
2019
+
2016
2020
  .h-\[80px\] {
2017
2021
  height: 80px;
2018
2022
  }
@@ -3883,6 +3887,11 @@ video {
3883
3887
  background-color: rgb(174 14 54 / var(--tw-bg-opacity));
3884
3888
  }
3885
3889
 
3890
+ .bg-red-200 {
3891
+ --tw-bg-opacity: 1;
3892
+ background-color: rgb(254 202 202 / var(--tw-bg-opacity));
3893
+ }
3894
+
3886
3895
  .bg-red-500 {
3887
3896
  --tw-bg-opacity: 1;
3888
3897
  background-color: rgb(239 68 68 / var(--tw-bg-opacity));
@@ -3902,6 +3911,10 @@ video {
3902
3911
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
3903
3912
  }
3904
3913
 
3914
+ .bg-opacity-0 {
3915
+ --tw-bg-opacity: 0;
3916
+ }
3917
+
3905
3918
  .bg-opacity-10 {
3906
3919
  --tw-bg-opacity: 0.1;
3907
3920
  }