Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added extra functionality to breadcrumbs #1144

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/components/Breadcrumbs/Breadcrumbs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import HomeIcon from "../../icons/HomeIcon";
import TestIcon from "../../utils/TestIcon";
import EyeIcon from "../../icons/EyeIcon";
import GlobalStyles from "../GlobalStyles";
import ButtonGroup from "../ButtonGroup";
import Button from "../Button";
import CopyIcon from "../../icons/CopyIcon";
import FolderPlusIcon from "../../icons/FolderPlusIcon";

export default {
title: "MDS/Layout/Breadcrumbs",
Expand Down Expand Up @@ -168,3 +172,21 @@ WithSubMenus.args = {
console.log(`CLICKED OPTION`, to);
},
};

export const WithPathActions = Template.bind({});
WithPathActions.args = {
options: subMenuOptions,
markCurrentItem: true,
onClickOption: (to: string) => {
console.log(`CLICKED OPTION`, to);
},
goBackFunction: () => {
alert("Go back!");
},
pathActions: (
<ButtonGroup>
<Button id={"button-1"} icon={<FolderPlusIcon />} />
<Button id={"button-2"} icon={<CopyIcon />} />
</ButtonGroup>
),
};
2 changes: 1 addition & 1 deletion src/components/Breadcrumbs/Breadcrumbs.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export const breadcrumbsTheme = (theme: Theme) => ({
display: "flex",
alignItems: "center",
marginRight: 10,
gap: 8,
"& .breadcrumbsList": {
display: "flex",
flexWrap: "nowrap",
flexGrow: 1,
textAlign: "left" as const,
marginLeft: 15,
marginRight: 10,
overflow: "hidden",
userSelect: "none",
Expand Down
1 change: 1 addition & 0 deletions src/components/Breadcrumbs/Breadcrumbs.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface BreadcrumbsProps {
displayLastItems?: false | number;
onClickOption?: (to?: string) => void;
children?: React.ReactNode;
pathActions?: React.ReactNode;
markCurrentItem?: boolean;
}

Expand Down
2 changes: 2 additions & 0 deletions src/components/Breadcrumbs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const Breadcrumbs: FC<BreadcrumbsProps> = ({
onClickOption,
markCurrentItem = false,
children,
pathActions,
}) => {
const theme = useTheme();

Expand Down Expand Up @@ -120,6 +121,7 @@ const Breadcrumbs: FC<BreadcrumbsProps> = ({
}}
/>
)}
{pathActions && <Box>{pathActions}</Box>}
<Box className={"breadcrumbsList"}>
{hasCollapsedOpts ? (
<Fragment>
Expand Down
Loading