Skip to content

Commit

Permalink
refactored the useBreadcrumbSize hook
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeriaMaltseva committed Dec 18, 2024
1 parent 8573b16 commit b067330
Show file tree
Hide file tree
Showing 29 changed files with 2,000 additions and 4,545 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,60 +23,28 @@ export const useBreadcrumbSize = (editorTabsWidth?: number, initialBreadcrumbLas
useLayoutEffect(() => {
if (editorTabsWidth == null || initialBreadcrumbLastElementWidth == null) return

if (editorTabsWidth <= 375) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(50)
}

if (editorTabsWidth > 375 && editorTabsWidth <= 450) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(70)
}

if (editorTabsWidth > 450 && editorTabsWidth <= 550) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(85)
}

if (editorTabsWidth > 550 && editorTabsWidth <= 700) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(100)
}

if (editorTabsWidth > 700 && editorTabsWidth <= 800) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(150)
}

if (editorTabsWidth > 800 && editorTabsWidth <= 900) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(200)
}

if (editorTabsWidth > 900 && editorTabsWidth <= 1000) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(300)
}

if (editorTabsWidth > 1000 && editorTabsWidth <= 1100) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(400)
}

if (editorTabsWidth > 1100 && editorTabsWidth <= 1200) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(500)
}

if (editorTabsWidth > 1200 && editorTabsWidth <= 1300) {
setIsHideBreadcrumb(true)
setCurrentBreadcrumbWidth(600)
}

if (editorTabsWidth > 1300) {
setIsHideBreadcrumb(false)
setCurrentBreadcrumbWidth(initialBreadcrumbLastElementWidth)
}
const getBreadcrumbSettings = (width: number): { isHide: boolean, width: number } => {
if (width <= 375) return { isHide: true, width: 50 }
if (width <= 450) return { isHide: true, width: 70 }
if (width <= 550) return { isHide: true, width: 85 }
if (width <= 700) return { isHide: true, width: 100 }
if (width <= 800) return { isHide: true, width: 150 }
if (width <= 900) return { isHide: true, width: 200 }
if (width <= 1000) return { isHide: true, width: 300 }
if (width <= 1100) return { isHide: true, width: 400 }
if (width <= 1200) return { isHide: true, width: 500 }
if (width <= 1300) return { isHide: true, width: 600 }

return {
isHide: false,
width: initialBreadcrumbLastElementWidth
}
}

const { isHide, width } = getBreadcrumbSettings(editorTabsWidth)

setIsHideBreadcrumb(isHide)
setCurrentBreadcrumbWidth(width)
}, [editorTabsWidth, initialBreadcrumbLastElementWidth])

return { isHideBreadcrumb, currentBreadcrumbWidth }
Expand Down

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions public/build/23c8ad28-c762-43d9-be01-c0d66755231a/vendor.js

This file was deleted.

This file was deleted.

14 changes: 0 additions & 14 deletions public/build/2b616333-0e6b-44c9-93dd-b5f755064fbd/entrypoints.json

This file was deleted.

1,964 changes: 0 additions & 1,964 deletions public/build/2b616333-0e6b-44c9-93dd-b5f755064fbd/manifest.json

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions public/build/34a6b750-a889-42f5-a58a-12755241637c/main.js

This file was deleted.

This file was deleted.

This file was deleted.

14 changes: 14 additions & 0 deletions public/build/34aa4b09-bbab-4024-87eb-d529a45ad24d/entrypoints.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"entrypoints": {
"main": {
"css": [
"http://localhost:3030/build/34aa4b09-bbab-4024-87eb-d529a45ad24d/vendors-node_modules_dnd-kit_modifiers_dist_modifiers_esm_js-node_modules_dnd-kit_sortable_di-cbce9d.css",
"http://localhost:3030/build/34aa4b09-bbab-4024-87eb-d529a45ad24d/main.css"
],
"js": [
"http://localhost:3030/build/34aa4b09-bbab-4024-87eb-d529a45ad24d/vendors-node_modules_dnd-kit_modifiers_dist_modifiers_esm_js-node_modules_dnd-kit_sortable_di-cbce9d.js",
"http://localhost:3030/build/34aa4b09-bbab-4024-87eb-d529a45ad24d/main.js"
]
}
}
}
Loading

0 comments on commit b067330

Please sign in to comment.