Skip to content

Commit 1bb912f

Browse files
authored
Merge pull request kubesphere#112 from chenz24/fix/dropdown
Export Progress component.
2 parents 6ec8da3 + dc41c69 commit 1bb912f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

.changeset/cyan-beds-dream.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[---
2+
'@kubed/components': patch
3+
---
4+
5+
1. Export Progress component.
6+
2. Omit trigger if visible is set.

packages/components/src/Dropdown/Dropdown.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { useState } from 'react';
22
import styled from 'styled-components';
3+
import { isUndefined } from 'lodash';
34
import { Tooltip, TooltipProps } from '../Tooltip/Tooltip';
45

56
const StyledTooltip = styled(Tooltip)<TooltipProps>`
@@ -37,11 +38,12 @@ export function Dropdown({
3738
maxWidth = 210,
3839
animation = 'shift-away',
3940
content,
41+
visible,
4042
...rest
4143
}: DropdownProps) {
4244
const [instance, setInstance] = useState(false);
4345
const onDropdownClick = () => {
44-
if (hideOnClick && instance) {
46+
if (hideOnClick && instance && !visible) {
4547
// @ts-ignore
4648
instance.hide();
4749
}
@@ -56,18 +58,19 @@ export function Dropdown({
5658
};
5759

5860
const popContent = <DropdownWrapper onClick={onDropdownClick}>{content}</DropdownWrapper>;
61+
const triggerProps = isUndefined(visible) ? { trigger } : { visible };
5962

6063
return (
6164
// @ts-ignore
6265
<StyledTooltip
6366
placement={placement}
64-
trigger={trigger}
6567
arrow={arrow}
6668
interactive={interactive}
6769
maxWidth={maxWidth}
6870
animation={animation}
6971
onMount={onMount}
7072
onDestroy={onDestroy}
73+
{...triggerProps}
7174
{...rest}
7275
content={popContent}
7376
>

packages/components/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ export { default as TimePicker } from './TimePicker/TimePicker';
3838
export { Banner, BannerTip } from './Banner/Banner';
3939
export { Notify, notify } from './Notify/Notify';
4040
export * from './ActionConfirm/ActionConfirm';
41+
export * from './Progress/Progress';

0 commit comments

Comments
 (0)