Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bielefeld-CeBiTec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2024 Competition
Bielefeld-CeBiTec
Commits
45eccb2a
Commit
45eccb2a
authored
5 months ago
by
Liliana Sanfilippo
Browse files
Options
Downloads
Patches
Plain Diff
engineering tab routing
parent
9c4967df
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#437659
failed
5 months ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/App/App.css
+5
-1
5 additions, 1 deletion
src/App/App.css
src/sidebars/engS.tsx
+3
-3
3 additions, 3 deletions
src/sidebars/engS.tsx
src/utils/openThem.ts
+49
-39
49 additions, 39 deletions
src/utils/openThem.ts
with
57 additions
and
43 deletions
src/App/App.css
+
5
−
1
View file @
45eccb2a
...
...
@@ -3765,4 +3765,8 @@ a{
color
:
var
(
--accent-primary
)
!important
;
margin-right
:
5px
;
top
:
5px
;
}
\ No newline at end of file
}
#eng-sidebar
a
{
color
:
var
(
--text-primary
)
!important
;
}
This diff is collapsed.
Click to expand it.
src/sidebars/engS.tsx
+
3
−
3
View file @
45eccb2a
...
...
@@ -26,10 +26,10 @@ export function EngSide(){
return
(
<
div
className
=
"col-2 d-none d-lg-block"
>
<
div
className
=
"col-2 d-none d-lg-block"
>
<
br
/>
<
div
className
=
"sticky-top"
>
<
nav
className
=
"sidebar"
>
<
nav
className
=
"sidebar"
id
=
"eng-sidebar"
>
<
div
>
<
a
onClick
=
{
openThem
({
it
:
"
our-cycle
"
,
scrollToId
:
"
ourcycle
"
})
}
>
<
div
className
=
"detail-sideitem"
>
...
...
@@ -187,7 +187,7 @@ export function EngSide(){
</
div
>
</
nav
>
<
br
/>
<
div
className
=
"col"
style
=
{
{
display
:
"
flex
"
,
alignItems
:
"
right
"
}
}
>
<
div
className
=
"col"
id
=
"eng-backup"
style
=
{
{
display
:
"
flex
"
,
alignItems
:
"
right
"
}
}
>
<
a
href
=
'#'
className
=
"backtotop"
>
Back to Top
↑
</
a
>
...
...
This diff is collapsed.
Click to expand it.
src/utils/openThem.ts
+
49
−
39
View file @
45eccb2a
export
function
openThem
({
it
,
scrollToId
}:
{
it
:
string
,
scrollToId
?:
string
})
{
const
gotoandopen
=
(
_event
:
React
.
MouseEvent
<
HTMLElement
,
MouseEvent
>
)
=>
{
console
.
log
(
"
it classname:
"
+
document
.
getElementById
(
it
)?.
className
);
console
.
log
(
"
it:
"
+
it
);
export
function
openThem
({
it
,
scrollToId
}:
{
it
:
string
;
scrollToId
?:
string
})
{
const
gotoandopen
=
(
_event
:
React
.
MouseEvent
<
HTMLElement
,
MouseEvent
>
)
=>
{
updateTabs
(
it
,
scrollToId
);
let
contenttabid
=
"
tab-
"
+
it
;
let
parent
=
"
parent-
"
+
it
;
console
.
log
(
"
we want to open
"
+
it
+
"
and
"
+
contenttabid
);
let
sideitems
=
document
.
getElementsByClassName
(
"
sideitem
"
);
let
subtabs
=
document
.
getElementsByClassName
(
"
sidesubtab
"
);
let
contenttabs
=
document
.
getElementsByClassName
(
"
enginneeringtab
"
);
// Verstecke alle Subtabs und Content-Tabs
for
(
let
i
=
0
;
i
<
subtabs
.
length
;
i
++
)
{
(
subtabs
[
i
]
as
HTMLElement
).
style
.
display
=
"
none
"
;
console
.
log
(
"
Hiding sidebar subtab...
"
);
}
for
(
let
i
=
0
;
i
<
contenttabs
.
length
;
i
++
)
{
(
contenttabs
[
i
]
as
HTMLElement
).
style
.
display
=
"
none
"
;
console
.
log
(
"
Hiding content tab...
"
);
}
for
(
let
i
=
0
;
i
<
sideitems
.
length
;
i
++
)
{
(
sideitems
[
i
]
as
HTMLElement
)
!
.
classList
.
remove
(
"
active-sideitem
"
);
console
.
log
(
"
Hiding sidebar subtab...
"
);
}
// Zeige den aktuellen Tab und markiere das entsprechende Sidebar-Item
document
.
getElementById
(
it
)
!
.
style
.
display
=
"
block
"
;
document
.
getElementById
(
parent
)
!
.
classList
.
add
(
"
active-sideitem
"
);
document
.
getElementById
(
contenttabid
)
!
.
style
.
display
=
"
block
"
;
// Scrolle zu der angegebenen ID, falls vorhanden
if
(
scrollToId
&&
document
.
getElementById
(
scrollToId
))
{
console
.
log
(
"
Scrolling to:
"
+
scrollToId
);
document
.
getElementById
(
scrollToId
)
!
.
scrollIntoView
({
behavior
:
"
smooth
"
});
}
};
return
gotoandopen
;
}
// Update der URL
const
newUrl
=
`?tab=
${
it
}
`
;
window
.
history
.
pushState
({
tab
:
it
},
''
,
newUrl
);
};
return
gotoandopen
;
}
function
updateTabs
(
it
:
string
,
scrollToId
?:
string
)
{
let
contenttabid
=
"
tab-
"
+
it
;
let
parent
=
"
parent-
"
+
it
;
// Verstecke alle Subtabs und Content-Tabs
const
subtabs
=
document
.
getElementsByClassName
(
"
sidesubtab
"
);
const
contenttabs
=
document
.
getElementsByClassName
(
"
enginneeringtab
"
);
const
sideitems
=
document
.
getElementsByClassName
(
"
sideitem
"
);
for
(
let
i
=
0
;
i
<
subtabs
.
length
;
i
++
)
{
(
subtabs
[
i
]
as
HTMLElement
).
style
.
display
=
"
none
"
;
}
for
(
let
i
=
0
;
i
<
contenttabs
.
length
;
i
++
)
{
(
contenttabs
[
i
]
as
HTMLElement
).
style
.
display
=
"
none
"
;
}
for
(
let
i
=
0
;
i
<
sideitems
.
length
;
i
++
)
{
(
sideitems
[
i
]
as
HTMLElement
)
!
.
classList
.
remove
(
"
active-sideitem
"
);
}
// Zeige den aktuellen Tab und markiere das entsprechende Sidebar-Item
document
.
getElementById
(
it
)
!
.
style
.
display
=
"
block
"
;
document
.
getElementById
(
parent
)
!
.
classList
.
add
(
"
active-sideitem
"
);
document
.
getElementById
(
contenttabid
)
!
.
style
.
display
=
"
block
"
;
// Scrolle zu der angegebenen ID, falls vorhanden
if
(
scrollToId
&&
document
.
getElementById
(
scrollToId
))
{
document
.
getElementById
(
scrollToId
)
!
.
scrollIntoView
({
behavior
:
"
smooth
"
});
}
}
// Füge einen Event Listener für `popstate` hinzu
window
.
addEventListener
(
'
popstate
'
,
(
event
)
=>
{
if
(
event
.
state
)
{
const
tab
=
event
.
state
.
tab
;
updateTabs
(
tab
);
}
});
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment