Skip to content

Commit

Permalink
Merge pull request kubesphere#112 from chenz24/fix/dropdown
Browse files Browse the repository at this point in the history
Export Progress component.
  • Loading branch information
chenz24 committed Nov 30, 2021
2 parents 6ec8da3 + dc41c69 commit 1bb912f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/cyan-beds-dream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[---
'@kubed/components': patch
---

1. Export Progress component.
2. Omit trigger if visible is set.
7 changes: 5 additions & 2 deletions packages/components/src/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import styled from 'styled-components';
import { isUndefined } from 'lodash';
import { Tooltip, TooltipProps } from '../Tooltip/Tooltip';

const StyledTooltip = styled(Tooltip)<TooltipProps>`
Expand Down Expand Up @@ -37,11 +38,12 @@ export function Dropdown({
maxWidth = 210,
animation = 'shift-away',
content,
visible,
...rest
}: DropdownProps) {
const [instance, setInstance] = useState(false);
const onDropdownClick = () => {
if (hideOnClick && instance) {
if (hideOnClick && instance && !visible) {
// @ts-ignore
instance.hide();
}
Expand All @@ -56,18 +58,19 @@ export function Dropdown({
};

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

return (
// @ts-ignore
<StyledTooltip
placement={placement}
trigger={trigger}
arrow={arrow}
interactive={interactive}
maxWidth={maxWidth}
animation={animation}
onMount={onMount}
onDestroy={onDestroy}
{...triggerProps}
{...rest}
content={popContent}
>
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ export { default as TimePicker } from './TimePicker/TimePicker';
export { Banner, BannerTip } from './Banner/Banner';
export { Notify, notify } from './Notify/Notify';
export * from './ActionConfirm/ActionConfirm';
export * from './Progress/Progress';

0 comments on commit 1bb912f

Please sign in to comment.