Skip to content

Commit

Permalink
Add tooltips for bookmark and edit path buttons
Browse files Browse the repository at this point in the history
Explain the bookmark and edit path button with a tooltip.

Related: cockpit-project#581
  • Loading branch information
jelly committed Jul 11, 2024
1 parent 70558cd commit d8a02bf
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/files-breadcrumbs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { Icon } from "@patternfly/react-core/dist/esm/components/Icon";
import { MenuToggle, MenuToggleElement } from "@patternfly/react-core/dist/esm/components/MenuToggle";
import { PageBreadcrumb } from "@patternfly/react-core/dist/esm/components/Page";
import { TextInput } from "@patternfly/react-core/dist/esm/components/TextInput";
import { Tooltip } from "@patternfly/react-core/dist/esm/components/Tooltip";
import { Flex, FlexItem } from "@patternfly/react-core/dist/esm/layouts/Flex";
import { CheckIcon, HddIcon, PencilAltIcon, StarIcon, TimesIcon } from "@patternfly/react-icons";
import { useInit } from "hooks.js";
Expand Down Expand Up @@ -167,14 +168,16 @@ function BookmarkButton({ path }: { path: string[] }) {
onOpenChange={(isOpen: boolean) => setIsOpen(isOpen)}
onSelect={handleSelect}
toggle={(toggleRef: React.Ref<MenuToggleElement>) => (
<MenuToggle
id="bookmark-btn"
variant="secondary"
icon={<StarIcon />}
ref={toggleRef}
onClick={() => setIsOpen(!isOpen)}
isExpanded={isOpen}
/>
<Tooltip content={_("Bookmarks")}>
<MenuToggle
id="bookmark-btn"
variant="secondary"
icon={<StarIcon />}
ref={toggleRef}
onClick={() => setIsOpen(!isOpen)}
isExpanded={isOpen}
/>
</Tooltip>
)}
>
<DropdownList>
Expand Down Expand Up @@ -258,12 +261,14 @@ export function FilesBreadcrumbs({ path, showHidden, setShowHidden }: { path: st
<Flex spaceItems={{ default: "spaceItemsSm" }}>
<BookmarkButton path={path} />
{!editMode &&
<Button
variant="secondary"
icon={<PencilAltIcon />}
onClick={() => enableEditMode()}
className="breadcrumb-button-edit"
/>}
<Tooltip content={_("Edit path")}>
<Button
variant="secondary"
icon={<PencilAltIcon />}
onClick={() => enableEditMode()}
className="breadcrumb-button-edit"
/>
</Tooltip>}
{!editMode && fullPath.map((dir, i) => {
return (
<React.Fragment key={fullPath.slice(0, i).join("/") || "/"}>
Expand Down

0 comments on commit d8a02bf

Please sign in to comment.