-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add info tooltip and tooltip for no changes gitignore
- Loading branch information
1 parent
d34ced5
commit cae31e4
Showing
5 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './info-tooltip' | ||
export * from './info-popover' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { useMemo, Ref } from 'react' | ||
import { InfoCircleFilled, InfoCircleOutlined } from '@ant-design/icons' | ||
import { AntdIconProps } from '@ant-design/icons/lib/components/AntdIcon' | ||
|
||
export interface InfoIconProps extends AntdIconProps { | ||
filled?: boolean | ||
ref?: Ref<HTMLSpanElement> | ||
} | ||
|
||
export const InfoIcon = ({ filled=true, style, ...other }: InfoIconProps) => { | ||
const Icon = useMemo(() => filled ? InfoCircleFilled : InfoCircleOutlined, [filled]) | ||
return ( | ||
<Icon | ||
className="info-circle" | ||
style={{ | ||
fontSize: 16, | ||
color: "rgb(85, 85, 85)", | ||
...style | ||
}} | ||
{ ...other } | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react' | ||
import { Popover, PopoverProps } from 'antd' | ||
import { InfoCircleFilled } from '@ant-design/icons' | ||
import { AntdIconProps } from '@ant-design/icons/lib/components/AntdIcon' | ||
import { ReactNode } from 'react' | ||
import { InfoIcon, InfoIconProps } from './info-icon' | ||
|
||
type InfoPopoverProps = PopoverProps & { | ||
iconProps?: InfoIconProps | ||
} | ||
|
||
export const InfoPopover = ({ | ||
iconProps={}, | ||
...tooltipProps | ||
}: InfoPopoverProps) => { | ||
return ( | ||
<Popover | ||
className="info-popover" | ||
trigger="click" | ||
{...tooltipProps } | ||
> | ||
<InfoIcon { ...iconProps } /> | ||
</Popover> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react' | ||
import { Tooltip, TooltipProps } from 'antd' | ||
import { InfoCircleFilled } from '@ant-design/icons' | ||
import { AntdIconProps } from '@ant-design/icons/lib/components/AntdIcon' | ||
import { ReactNode } from 'react' | ||
import { InfoIcon, InfoIconProps } from './info-icon' | ||
|
||
type InfoTooltipProps = TooltipProps & { | ||
iconProps?: InfoIconProps | ||
} | ||
|
||
export const InfoTooltip = ({ | ||
iconProps={}, | ||
...tooltipProps | ||
}: InfoTooltipProps) => { | ||
return ( | ||
<Tooltip | ||
className="info-tooltip" | ||
trigger="click" | ||
{...tooltipProps } | ||
> | ||
<InfoIcon { ...iconProps } /> | ||
</Tooltip> | ||
) | ||
} |