Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
2cbe9fe7
Commit
2cbe9fe7
authored
8 years ago
by
Lewis Liu
Browse files
Options
Downloads
Patches
Plain Diff
Refactored breadcrumbs implementation
parent
1574de3f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/src/metabase/components/Breadcrumbs.jsx
+33
-33
33 additions, 33 deletions
frontend/src/metabase/components/Breadcrumbs.jsx
with
33 additions
and
33 deletions
frontend/src/metabase/components/Breadcrumbs.jsx
+
33
−
33
View file @
2cbe9fe7
...
...
@@ -26,41 +26,41 @@ export default class Breadcrumbs extends Component {
const
breadcrumbClass
=
inSidebar
?
S
.
sidebarBreadcrumb
:
S
.
breadcrumb
;
const
breadcrumbsClass
=
inSidebar
?
S
.
sidebarBreadcrumbs
:
S
.
breadcrumbs
;
const
children
=
[];
// TODO: maybe refactor this a bit to make it clearer how to use?
for
(
let
[
index
,
crumb
]
of
crumbs
.
entries
())
{
crumb
=
Array
.
isArray
(
crumb
)
?
crumb
:
[
crumb
];
if
(
crumb
.
length
>
1
)
{
children
.
push
(
// TODO: ideally tooltips should only show when element overflows
// but I can't seem to figure out how to actually implement it in React
<
Tooltip
tooltip
=
{
crumb
[
0
]
}
>
<
a
className
=
{
cx
(
breadcrumbClass
,
S
.
breadcrumbPath
)
}
href
=
{
crumb
[
1
]
}
>
{
crumb
[
0
]
}
</
a
>
</
Tooltip
>
);
}
else
{
children
.
push
(
<
Tooltip
tooltip
=
{
crumb
[
0
]
}
>
<
h2
className
=
{
cx
(
breadcrumbClass
,
S
.
breadcrumbPage
)
}
>
{
crumb
}
</
h2
>
</
Tooltip
>
);
}
if
(
index
<
crumbs
.
length
-
1
)
{
children
.
push
(<
Icon
name
=
"chevronright"
className
=
{
S
.
breadcrumbDivider
}
width
=
{
12
}
height
=
{
12
}
/>);
}
}
return
(
<
section
className
=
{
breadcrumbsClass
}
>
{
children
}
{
crumbs
.
map
(
breadcrumb
=>
Array
.
isArray
(
breadcrumb
)
?
breadcrumb
:
[
breadcrumb
])
.
map
((
breadcrumb
,
index
)
=>
breadcrumb
.
length
>
1
?
// TODO: ideally tooltips should only show when element overflows
// but I can't seem to figure out how to actually implement it in React
<
Tooltip
key
=
{
index
}
tooltip
=
{
breadcrumb
[
0
]
}
>
<
a
className
=
{
cx
(
breadcrumbClass
,
S
.
breadcrumbPath
)
}
href
=
{
breadcrumb
[
1
]
}
>
{
breadcrumb
[
0
]
}
</
a
>
</
Tooltip
>
:
<
Tooltip
key
=
{
index
}
tooltip
=
{
breadcrumb
[
0
]
}
>
<
h2
className
=
{
cx
(
breadcrumbClass
,
S
.
breadcrumbPage
)
}
>
{
breadcrumb
}
</
h2
>
</
Tooltip
>
)
.
map
((
breadcrumb
,
index
,
breadcrumbs
)
=>
index
<
breadcrumbs
.
length
-
1
?
[
breadcrumb
,
<
Icon
key
=
{
`
${
index
}
-separator`
}
name
=
"chevronright"
className
=
{
S
.
breadcrumbDivider
}
width
=
{
12
}
height
=
{
12
}
/>
]
:
breadcrumb
)
}
</
section
>
);
}
...
...
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