Skip to content

Commit

Permalink
Move alt view dropdown to a button (#1174)
Browse files Browse the repository at this point in the history
Alt View dropdown is currently a `div` which does not display a pointer
cursor when hovering and you sometimes end selecting text in it.

## Which problem is this PR solving?
- Alt View button gets its text selected sometimes when clicking
- Alt View dropdown shows text cursor instead of pointer cursor

## Short description of the changes
- Move Alt View dropdown to a button as shown in Ant Design examples:
https://ant.design/components/dropdown

<img width="426" alt="Screenshot 2023-02-04 at 15 48 30"
src="https://user-images.githubusercontent.com/2519238/216774061-c2cf6a4e-2dc0-4ca4-a2ae-41906737e5bd.png">

Signed-off-by: Sergio-Mira <sergio.mira@zendesk.com>
  • Loading branch information
Sergio-Mira committed Feb 5, 2023
1 parent d0915ea commit f3da647
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

import * as React from 'react';
import { Dropdown, Icon, Menu } from 'antd';
import { Dropdown, Icon, Menu, Button } from 'antd';
import { Link } from 'react-router-dom';
import './AltViewOptions.css';

Expand Down Expand Up @@ -109,10 +109,10 @@ export default function AltViewOptions(props: Props) {
const dropdownText = currentItem ? currentItem.label : 'Alternate Views';
return (
<Dropdown overlay={menu}>
<div className="AltViewOptions">
<Button className="AltViewOptions">
{`${dropdownText} `}
<Icon type="down" />
</div>
</Button>
</Dropdown>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,17 @@ exports[`AltViewOptions renders correctly 1`] = `
placement="bottomLeft"
prefixCls="ant-dropdown"
>
<div
<Button
block={false}
className="AltViewOptions"
ghost={false}
loading={false}
prefixCls="ant-btn"
>
Trace Timeline
<Icon
type="down"
/>
</div>
</Button>
</Dropdown>
`;

0 comments on commit f3da647

Please sign in to comment.