Skip to content

Commit

Permalink
docs: fix flash white box (#7877)
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhan committed May 16, 2022
1 parent 727c059 commit 5897837
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docs/next/components/mdx/MDXRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const BreadcrumbNav = () => {
<ol className="md:inline-flex space-x-1 lg:space-x-3">
{breadcrumbItems.map((item, index) => {
return (
<li key={item.title}>
<li key={item.path || item.title}>
<div className="flex flex-nowrap items-center">
{index > 0 && (
<svg
Expand Down
18 changes: 11 additions & 7 deletions docs/next/components/mdx/SidebarNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,15 @@ const useActiveId = (itemIds) => {

const MARGINS = ["ml-0", "ml-2", "ml-4", "ml-8"];

const renderItems = (items, activeId, depth) => {
const renderItems = (items, activeId, depth, key) => {
return (
<ol>
{items.map((item) => {
<ol key={key}>
{items.map((item, idx) => {
return item.url ? (
<li key={item.url} className={cx(MARGINS[depth], "mt-3 list-inside")}>
<li
key={`${key}-${idx}`}
className={cx(MARGINS[depth], "mt-3 list-inside")}
>
<a
href={item.url}
className={cx(
Expand All @@ -123,10 +126,11 @@ const renderItems = (items, activeId, depth) => {
>
{item.title}
</a>
{item.items && renderItems(item.items, activeId, depth + 1)}
{item.items &&
renderItems(item.items, activeId, depth + 1, `${key}-${idx}`)}
</li>
) : (
renderItems(item.items, activeId, depth)
renderItems(item.items, activeId, depth, `${key}-${idx}`)
);
})}
</ol>
Expand All @@ -139,7 +143,7 @@ const SidebarNavigation = ({ items }) => {
}
const idList = getIds(items);
const activeId = useActiveId(idList);
return renderItems(items, activeId, 0);
return renderItems(items, activeId, 0, 0);
};

export default SidebarNavigation;

1 comment on commit 5897837

@vercel
Copy link

@vercel vercel bot commented on 5897837 May 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.