-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Schema Browser UI and memoize update (#1268)
- Loading branch information
Showing
7 changed files
with
226 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/*! | ||
* Copyright © 2023 United States Government as represented by the | ||
* Administrator of the National Aeronautics and Space Administration. | ||
* All Rights Reserved. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { | ||
Breadcrumb, | ||
BreadcrumbBar, | ||
BreadcrumbLink, | ||
} from '@trussworks/react-uswds' | ||
|
||
export default function BreadcrumbNav({ | ||
path, | ||
pathPrepend, | ||
className, | ||
}: { | ||
path: string | ||
pathPrepend?: string | ||
className?: string | ||
}) { | ||
const breadcrumbs = path.split('/') | ||
const lastBreadcrumb = breadcrumbs.pop() | ||
|
||
let cumulativePath = pathPrepend | ||
return ( | ||
<BreadcrumbBar className={className}> | ||
<> | ||
{...breadcrumbs.map((breadcrumb) => { | ||
cumulativePath = `${cumulativePath}/${breadcrumb}` | ||
return ( | ||
<Breadcrumb key={cumulativePath}> | ||
<BreadcrumbLink href={cumulativePath}> | ||
{breadcrumb} | ||
</BreadcrumbLink> | ||
</Breadcrumb> | ||
) | ||
})} | ||
</> | ||
<Breadcrumb> | ||
<Breadcrumb current> | ||
<h2 className="margin-y-0 display-inline">{lastBreadcrumb}</h2> | ||
</Breadcrumb> | ||
</Breadcrumb> | ||
</BreadcrumbBar> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.