Download wp-calypso/client/sites/hooks/breadcrumbs/use-breadcrumbs.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 685 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/sites/hooks/breadcrumbs/use-breadcrumbs.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/sites/hooks/breadcrumbs/use-breadcrumbs.ts
-
curl -L -o use-breadcrumbs.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/sites/hooks/breadcrumbs/use-breadcrumbs.ts
685 Bytes
| import { Item as BreadcrumbItem } from 'calypso/components/breadcrumb'; | |
| import { useSelector } from 'calypso/state'; | |
| import { getBreadcrumbs } from 'calypso/state/breadcrumb/selectors'; | |
| export function useBreadcrumbs() { | |
| const breadcrumbs = useSelector( getBreadcrumbs ); | |
| const shouldShowBreadcrumbs = breadcrumbs.some( | |
| ( item: BreadcrumbItem ) => item.id === 'feature' | |
| ); | |
| return { | |
| // In sites dashboard, the components are rendered from the innermost level, | |
| // and so the breadcrumb items are added in reversed order. | |
| // Here we reverse them again so that they are shown in the correct order. | |
| breadcrumbs: [ ...breadcrumbs ].reverse(), | |
| shouldShowBreadcrumbs, | |
| }; | |
| } | |