@@ -56,51 +56,6 @@ const menus = [
5656 } ,
5757] ;
5858
59- // eslint-disable-next-line @typescript-eslint/no-unused-vars
60- function findBreadcrumbInfo ( path : string ) {
61- if ( path === "/" || path === "" ) {
62- return {
63- paths : [ { text : "홈" , href : "/" } ] ,
64- title : "홈" ,
65- } ;
66- }
67-
68- const normalizedPath = path . replace ( / ^ \/ | \/ $ / g, "" ) ;
69-
70- const breadcrumbPaths = [ { text : "홈" , href : "/" } ] ;
71- let pageTitle = "" ;
72-
73- for ( const menu of menus ) {
74- for ( const subMenu of menu . subMenu ) {
75- const subMenuPath = subMenu . href . replace ( / ^ \/ | \/ $ / g, "" ) ;
76-
77- if ( subMenuPath === normalizedPath ) {
78- breadcrumbPaths . push ( { text : menu . text , href : subMenu . href } ) ;
79- pageTitle = subMenu . text ;
80- return { paths : breadcrumbPaths , title : pageTitle } ;
81- }
82-
83- if ( subMenu . subMenu ) {
84- for ( const thirdMenu of subMenu . subMenu ) {
85- const thirdMenuPath = thirdMenu . href . replace ( / ^ \/ | \/ $ / g, "" ) ;
86-
87- if ( thirdMenuPath === normalizedPath ) {
88- breadcrumbPaths . push ( { text : menu . text , href : subMenu . href } ) ;
89- breadcrumbPaths . push ( { text : subMenu . text , href : subMenu . href } ) ;
90- pageTitle = thirdMenu . text ;
91- return { paths : breadcrumbPaths , title : pageTitle } ;
92- }
93- }
94- }
95- }
96- }
97-
98- return {
99- paths : [ { text : "홈" , href : "/" } ] ,
100- title : normalizedPath . charAt ( 0 ) . toUpperCase ( ) + normalizedPath . slice ( 1 ) ,
101- } ;
102- }
103-
10459export default function BreadCrumb ( ) {
10560 const [ breadcrumbInfo , setBreadcrumbInfo ] = useState ( {
10661 paths : [ { text : "홈" , href : "/" } ] ,
0 commit comments