Skip to content

Commit

Permalink
Removed buttons inside menuitems
Browse files Browse the repository at this point in the history
  • Loading branch information
rafawendel committed Mar 4, 2021
1 parent 85f2831 commit 93ff830
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useMemo } from "react";
import { first, includes } from "lodash";
import Menu from "antd/lib/menu";
import Link from "@/components/Link";
import PlainButton from "@/components/PlainButton";
import HelpTrigger from "@/components/HelpTrigger";
import CreateDashboardDialog from "@/components/dashboards/CreateDashboardDialog";
import { useCurrentRoute } from "@/components/ApplicationArea/Router";
Expand Down Expand Up @@ -129,10 +128,11 @@ export default function DesktopNavbar() {
</Menu.Item>
)}
{canCreateDashboard && (
<Menu.Item key="new-dashboard">
<PlainButton data-test="CreateDashboardMenuItem" onClick={() => CreateDashboardDialog.showModal()}>
New Dashboard
</PlainButton>
<Menu.Item
key="new-dashboard"
data-test="CreateDashboardMenuItem"
onClick={() => CreateDashboardDialog.showModal()}>
New Dashboard
</Menu.Item>
)}
{canCreateAlert && (
Expand Down Expand Up @@ -182,10 +182,8 @@ export default function DesktopNavbar() {
</Menu.Item>
)}
<Menu.Divider />
<Menu.Item key="logout">
<PlainButton data-test="LogOutButton" onClick={() => Auth.logout()}>
Log out
</PlainButton>
<Menu.Item key="logout" data-test="LogOutButton" onClick={() => Auth.logout()}>
Log out
</Menu.Item>
<Menu.Divider />
<Menu.Item key="version" role="presentation" disabled className="version-info">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from "react";
import PropTypes from "prop-types";
import Dropdown from "antd/lib/dropdown";
import Menu from "antd/lib/menu";
import PlainButton from "@/components/PlainButton";
import { clientConfig } from "@/services/auth";
import Button from "antd/lib/button";

Expand All @@ -18,19 +17,15 @@ export default function QueryControlDropdown(props) {
const menu = (
<Menu>
{!props.query.isNew() && (!props.query.is_draft || !props.query.is_archived) && (
<Menu.Item>
<PlainButton onClick={() => props.openAddToDashboardForm(props.selectedTab)}>
<PlusCircleFilledIcon /> Add to Dashboard
</PlainButton>
<Menu.Item onClick={() => props.openAddToDashboardForm(props.selectedTab)}>
<PlusCircleFilledIcon /> Add to Dashboard
</Menu.Item>
)}
{!clientConfig.disablePublicUrls && !props.query.isNew() && (
<Menu.Item>
<PlainButton
onClick={() => props.showEmbedDialog(props.query, props.selectedTab)}
data-test="ShowEmbedDialogButton">
<ShareAltOutlinedIcon /> Embed Elsewhere
</PlainButton>
<Menu.Item
onClick={() => props.showEmbedDialog(props.query, props.selectedTab)}
data-test="ShowEmbedDialogButton">
<ShareAltOutlinedIcon /> Embed Elsewhere
</Menu.Item>
)}
<Menu.Item>
Expand Down
13 changes: 6 additions & 7 deletions client/app/components/TagsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,12 @@ function TagsList({ tagsUrl, showUnselectAll = false, onUpdate }: TagsListProps)
<div className="tiled">
<Menu className="invert-stripe-position" mode="inline" selectedKeys={selectedTags}>
{map(allTags, tag => (
<Menu.Item key={tag.name} className="m-0">
<PlainButton
className="d-flex align-items-center justify-content-between"
onClick={event => toggleTag(event, tag.name)}>
<span className="max-character col-xs-11">{tag.name}</span>
<Badge count={tag.count} />
</PlainButton>
<Menu.Item
key={tag.name}
className="m-0 d-flex align-items-center justify-content-between"
onClick={event => toggleTag(event, tag.name)}>
<span className="max-character col-xs-11">{tag.name}</span>
<Badge count={tag.count} />
</Menu.Item>
))}
</Menu>
Expand Down
17 changes: 5 additions & 12 deletions client/app/pages/dashboards/components/DashboardHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import cx from "classnames";
import PropTypes from "prop-types";
import { map, includes } from "lodash";
import Button from "antd/lib/button";
import PlainButton from "@/components/PlainButton";
import Dropdown from "antd/lib/dropdown";
import Menu from "antd/lib/menu";
import EllipsisOutlinedIcon from "@ant-design/icons/EllipsisOutlined";
Expand Down Expand Up @@ -138,22 +137,16 @@ function DashboardMoreOptionsButton({ dashboardConfiguration }) {
placement="bottomRight"
overlay={
<Menu data-test="DashboardMoreButtonMenu">
<Menu.Item className={cx({ hidden: gridDisabled })}>
<PlainButton onClick={() => setEditingLayout(true)}>Edit</PlainButton>
<Menu.Item className={cx({ hidden: gridDisabled })} onClick={() => setEditingLayout(true)}>
Edit
</Menu.Item>
{clientConfig.showPermissionsControl && isDashboardOwnerOrAdmin && (
<Menu.Item>
<PlainButton onClick={managePermissions}>Manage Permissions</PlainButton>
</Menu.Item>
<Menu.Item onClick={managePermissions}>Manage Permissions</Menu.Item>
)}
{!clientConfig.disablePublish && !dashboard.is_draft && (
<Menu.Item>
<PlainButton onClick={togglePublished}>Unpublish</PlainButton>
</Menu.Item>
<Menu.Item onClick={togglePublished}>Unpublish</Menu.Item>
)}
<Menu.Item>
<PlainButton onClick={archive}>Archive</PlainButton>
</Menu.Item>
<Menu.Item onClick={archive}>Archive</Menu.Item>
</Menu>
}>
<Button className="icon-button m-l-5" data-test="DashboardMoreButton">
Expand Down

0 comments on commit 93ff830

Please sign in to comment.