mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
bf45e97641
* Update types * fix circular dep * type imports * lint type imports and --fix
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { ArchiveIcon } from "outline-icons";
|
|
import * as React from "react";
|
|
import { useTranslation } from "react-i18next";
|
|
import type Collection from "~/models/Collection";
|
|
import CollectionIcon from "~/components/Icons/CollectionIcon";
|
|
import { archivePath, collectionPath } from "~/utils/routeHelpers";
|
|
import Breadcrumb from "./Breadcrumb";
|
|
import { createInternalLinkAction } from "~/actions";
|
|
import { ActiveCollectionSection } from "~/actions/sections";
|
|
|
|
type Props = {
|
|
collection: Collection;
|
|
};
|
|
|
|
export const CollectionBreadcrumb: React.FC<Props> = ({ collection }) => {
|
|
const { t } = useTranslation();
|
|
|
|
const actions = React.useMemo(
|
|
() => [
|
|
createInternalLinkAction({
|
|
name: t("Archive"),
|
|
section: ActiveCollectionSection,
|
|
icon: <ArchiveIcon />,
|
|
visible: collection.isArchived,
|
|
to: archivePath(),
|
|
}),
|
|
createInternalLinkAction({
|
|
name: collection.name,
|
|
section: ActiveCollectionSection,
|
|
icon: <CollectionIcon collection={collection} expanded />,
|
|
to: collectionPath(collection),
|
|
}),
|
|
],
|
|
[collection, t]
|
|
);
|
|
|
|
return <Breadcrumb actions={actions} highlightFirstItem />;
|
|
};
|