-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #402 from corypride/383-refactor-heroIcons
HeroIcon refactor - ResourceManagement.tsx
- Loading branch information
Showing
5 changed files
with
161 additions
and
167 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,34 @@ | ||
import * as React from 'react'; | ||
|
||
type ULIComponentProps = { | ||
tooltipClassName?: string; //for applying classes other than 'tooltip' | ||
iconClassName?: string; //for applying classes other than 'w-4 h-4' | ||
dataTip?: string; | ||
onClick?: () => void; | ||
onMouseDown?: () => void; | ||
icon: React.ForwardRefExoticComponent< | ||
React.PropsWithoutRef<React.SVGProps<SVGSVGElement>> & { | ||
title?: string; | ||
titleId?: string; | ||
} & React.RefAttributes<SVGSVGElement> | ||
>; | ||
}; | ||
|
||
export default function ULIComponent(props: ULIComponentProps) { | ||
// Case 1: a icon with tooltipClassName 'w-4 h-4 self-start cursor-pointer' | ||
// Case 2: an icon that needs the default width overridden with a prop value: this will be applied to the className as well | ||
// Case 3: an icon without 'self-start cursor-pointer' | ||
|
||
return ( | ||
<div | ||
className={`tooltip ${props.tooltipClassName}`} | ||
data-tip={props.dataTip} | ||
> | ||
<props.icon | ||
className={`w-4 h-4 ${props.iconClassName}`} | ||
onClick={props.onClick} | ||
onMouseDown={props.onMouseDown} | ||
/> | ||
</div> | ||
); | ||
} |
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
Oops, something went wrong.