Skip to content

Commit

Permalink
feat(component): icon button component
Browse files Browse the repository at this point in the history
  • Loading branch information
drl990114 committed Sep 5, 2023
1 parent 553e15e commit df29a30
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
1 change: 0 additions & 1 deletion apps/desktop/src/components/CopyBtn/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Container = styled.span<ContainerProps>`
color: ${(props) => (props.checking ? props.theme.successColor : props.theme.primaryFontColor)};
`

export const CopyBtn: FC<CopyBtnProps> = (props) => {
export const CopyButton: FC<CopyBtnProps> = (props) => {
const { text } = props
const [checking, setChecking] = useState(false)

Expand Down
25 changes: 25 additions & 0 deletions apps/desktop/src/components/UI/Button/icon-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { TooltipProps } from '@mui/material'
import { Tooltip } from '@mui/material'
import classNames from 'classnames'

interface MfIconButtonProps {
icon: string
onClick: () => void
tooltipProps?: Omit<TooltipProps, 'children'>
}

export const MfIconButton = (props: MfIconButtonProps) => {
const { icon, onClick, tooltipProps } = props

const iconCls = classNames('icon', icon)

if (tooltipProps) {
return (
<Tooltip arrow {...tooltipProps}>
<i className={iconCls} onClick={onClick}></i>
</Tooltip>
)
}

return <i className={iconCls} onClick={onClick}></i>
}
2 changes: 2 additions & 0 deletions apps/desktop/src/components/UI/Button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './icon-button'
export * from './copy-button'

0 comments on commit df29a30

Please sign in to comment.