Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Digital course file
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SE-PROJECT-TEAM
Digital course file
Commits
cc2e8045
Commit
cc2e8045
authored
Mar 3, 2021
by
Nidharshan A
Browse files
Options
Downloads
Patches
Plain Diff
Replace FolderNav.js
parent
169e58c3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
digital-course-file/src/user/FolderNav.js
+40
-42
40 additions, 42 deletions
digital-course-file/src/user/FolderNav.js
with
40 additions
and
42 deletions
digital-course-file/src/user/FolderNav.js
+
40
−
42
View file @
cc2e8045
import
React
from
'
react
'
;
import
AddFolder
from
"
./AddFolder
"
;
import
{
Container
,
Button
}
from
"
react-bootstrap
"
;
import
{
useFolder
}
from
"
.././hooks/useFolder
"
;
import
Folder
from
"
./Folder
"
;
import
FolderNav
from
"
./FolderNav
"
;
import
{
useParams
}
from
"
react-router-dom
"
;
import
{
react
}
from
"
react
"
;
import
{
Breadcrumb
}
from
"
react-bootstrap
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
{
ROOT_FOLDER
}
from
"
../hooks/useFolder
"
;
const
Hero
=
({
handleLogout
})
=>
{
export
default
function
FolderNav
(
{
currentFolder
}
)
{
const
{
folderId
}
=
useParams
();
const
{
folder
,
childFolders
}
=
useFolder
(
folderId
);
return
(
<>
<
section
className
=
"
hero
"
>
<
nav
>
<
h2
>
Course
File
<
/h2
>
<
button
className
=
"
logoutbutton
"
onClick
=
{
handleLogout
}
>
Logout
<
/button
>
<
/nav
>
<
/section
>
let
path
=
currentFolder
===
ROOT_FOLDER
?
[]
:
[
ROOT_FOLDER
]
if
(
currentFolder
){
path
=
[...
path
,...
currentFolder
.
path
];
}
<
Container
fluid
>
Contents
<
/Container
>
<
Container
fluid
>
<
div
className
=
"
d-flex align-items-center
"
>
<
FolderNav
currentFolder
=
{
folder
}
/
>
<
AddFolder
currentFolder
=
{
folder
}
/
>
<
/div
>
{
childFolders
.
length
>
0
&&
(
<
div
className
=
"
d-flex flex-wrap
"
>
{
childFolders
.
map
(
childFolder
=>
(
<
div
key
=
{
childFolder
.
id
}
style
=
{
{
maxWidth
:
"
250px
"
}}
className
=
"
p-2
"
return
(
<
Breadcrumb
className
=
"
flex-grow-1
"
listProps
=
{{
className
:
"
bg-white pl-0 m-0
"
}}
>
<
Folder
folder
=
{
childFolder
}
><
/Folder
>
<
/div
>
{
path
.
map
((
folder
,
index
)
=>
(
<
Breadcrumb
.
Item
key
=
{
folder
.
id
}
linkAs
=
{
Link
}
linkProps
=
{{
to
:
folder
.
id
?
`/folder/
${
folder
.
id
}
`
:
"
/
"
,
}}
className
=
"
text-truncate d-inline-block
"
style
=
{
{
maxWidth
:
"
175px
"
}
}
>
{
folder
.
name
}
<
/Breadcrumb.Item
>
))}
<
/div
>
)}
{
currentFolder
&&
(
<
Breadcrumb
.
Item
className
=
"
text-truncate d-inline-block
"
style
=
{
{
maxWidth
:
"
200px
"
}
}
active
>
{
currentFolder
.
name
}
<
/Breadcrumb.Item
>
)
<
/Container
>
<
/
>
}
<
/
Breadcrumb
>
);
}
\ No newline at end of file
export
default
Hero
;
\ 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