mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-27 01:03:08 +03:00
feat(Filter/Breadcrumb): delete Breadcrumb component
This commit is contained in:
parent
c592dc6520
commit
f22e79aac2
@ -1,63 +0,0 @@
|
|||||||
import * as React from "react";
|
|
||||||
import * as System from "~/components/system";
|
|
||||||
import * as Styles from "~/common/styles";
|
|
||||||
import * as Strings from "~/common/strings";
|
|
||||||
|
|
||||||
import { useFilterContext } from "~/components/core/Filter/Provider";
|
|
||||||
import { css } from "@emotion/react";
|
|
||||||
import { FILTER_VIEWS_IDS, FILTER_TYPES } from "~/common/filter-utilities";
|
|
||||||
import { Show } from "~/components/utility/Show";
|
|
||||||
|
|
||||||
const STYLES_BREADCRUMB_BUTTON = (theme) => css`
|
|
||||||
${Styles.BUTTON_RESET};
|
|
||||||
:hover {
|
|
||||||
color: ${theme.semantic.textBlack};
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
function Item({ children, color, includeDelimiter, ...props }) {
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
{includeDelimiter && (
|
|
||||||
<System.P2 as="span" color="textGray">
|
|
||||||
{" "}
|
|
||||||
/{" "}
|
|
||||||
</System.P2>
|
|
||||||
)}
|
|
||||||
<button css={STYLES_BREADCRUMB_BUTTON} {...props}>
|
|
||||||
<System.P2 color={color}>{children}</System.P2>
|
|
||||||
</button>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Breadcrumb(props) {
|
|
||||||
const [{ filterState }, { setFilterType, resetFilterState }] = useFilterContext();
|
|
||||||
const isCurrentViewInitial = filterState.view === FILTER_VIEWS_IDS.initial;
|
|
||||||
|
|
||||||
const changeFilterToBrowerView = () =>
|
|
||||||
setFilterType({
|
|
||||||
view: FILTER_VIEWS_IDS.browser,
|
|
||||||
type: FILTER_TYPES[FILTER_VIEWS_IDS.browser].filters.initial,
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div {...props}>
|
|
||||||
<Show when={!isCurrentViewInitial}>
|
|
||||||
<Item onClick={resetFilterState} color="textGray">
|
|
||||||
All
|
|
||||||
</Item>
|
|
||||||
<Item
|
|
||||||
includeDelimiter
|
|
||||||
color={filterState.subview ? "textGray" : "textBlack"}
|
|
||||||
onClick={changeFilterToBrowerView}
|
|
||||||
>
|
|
||||||
{Strings.capitalize(filterState.view)}
|
|
||||||
</Item>
|
|
||||||
</Show>
|
|
||||||
<Show when={filterState.subview}>
|
|
||||||
<Item includeDelimiter>{Strings.capitalize(filterState.subview)}</Item>
|
|
||||||
</Show>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
@ -2,7 +2,6 @@ import * as React from "react";
|
|||||||
import * as System from "~/components/system";
|
import * as System from "~/components/system";
|
||||||
|
|
||||||
import { Navbar, NavbarPortal } from "~/components/core/Filter/Navbar";
|
import { Navbar, NavbarPortal } from "~/components/core/Filter/Navbar";
|
||||||
import { Breadcrumb } from "~/components/core/Filter/Breadcrumb";
|
|
||||||
import { Provider } from "~/components/core/Filter/Provider";
|
import { Provider } from "~/components/core/Filter/Provider";
|
||||||
import { Sidebar, SidebarTrigger } from "~/components/core/Filter/Sidebar";
|
import { Sidebar, SidebarTrigger } from "~/components/core/Filter/Sidebar";
|
||||||
import { Content } from "~/components/core/Filter/Content";
|
import { Content } from "~/components/core/Filter/Content";
|
||||||
@ -22,14 +21,4 @@ function Actions() {
|
|||||||
return <div />;
|
return <div />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export {
|
export { Title, Actions, Sidebar, SidebarTrigger, Provider, Navbar, Content, NavbarPortal };
|
||||||
Title,
|
|
||||||
Actions,
|
|
||||||
Sidebar,
|
|
||||||
SidebarTrigger,
|
|
||||||
Provider,
|
|
||||||
Navbar,
|
|
||||||
Content,
|
|
||||||
Breadcrumb,
|
|
||||||
NavbarPortal,
|
|
||||||
};
|
|
||||||
|
@ -49,7 +49,6 @@ export default function SceneFilesFolder({ viewer, page, onAction, isMobile }) {
|
|||||||
<Filter.NavbarPortal>
|
<Filter.NavbarPortal>
|
||||||
<div css={Styles.CONTAINER_CENTERED}>
|
<div css={Styles.CONTAINER_CENTERED}>
|
||||||
<Filter.SidebarTrigger />
|
<Filter.SidebarTrigger />
|
||||||
<Filter.Breadcrumb style={{ marginLeft: 16 }} />
|
|
||||||
</div>
|
</div>
|
||||||
<div css={STYLES_FILTER_TITLE_WRAPPER}>
|
<div css={STYLES_FILTER_TITLE_WRAPPER}>
|
||||||
<Filter.Title />
|
<Filter.Title />
|
||||||
|
Loading…
Reference in New Issue
Block a user