-
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.
Fix link, remove .schema.json from display name, pull correct example…
… files Update UI to use breadcrumb UI, simplify left nav, move version button Update schema browser wording, Update breadcrumb sizing, Fix links for relative paths to other schemas, Scraps side nav for cards Memoize all the things Use useWindowSize hook to improve UI for current folder name Generalize breadcrumb to component Remove old error catch
- Loading branch information
Showing
7 changed files
with
212 additions
and
152 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.