Skip to content

Commit

Permalink
✨ Added anchor style prop
Browse files Browse the repository at this point in the history
  • Loading branch information
prateek3255 committed Aug 1, 2020
1 parent 7b22874 commit 16a9ba2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ You can customize almost every aspect of this component using the below props, o
| children | ReactNode | null | Use this if you want to use some custom component inside the anchor tag. |
| defaultTooltip | string | "Copy email address" | Text shown in the tooltip when the user hovers over the link. |
| copiedTooltip | string | "Copied to clipboard!" | Text shown in the tooltip when the user clicks on the link and the text is copied to clipboard. |
| containerStyles | style object | none | The styles to be applied to the anchor container |
| containerStyles | style object | none | The styles to be applied to the container |
| tooltipStyles | style object | none | The styles to be applied to the tooltip |
| anchorStyles | style object | none | The styles to be applied to the anchor |

## Development

Expand Down
3 changes: 3 additions & 0 deletions src/lib/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ const CopyMailTo = ({
copiedTooltip = "Copied to clipboard!",
containerStyles = {},
tooltipStyles = {},
anchorStyles = {},
}: {
email: string;
children?: React.ReactNode;
defaultTooltip?: string;
copiedTooltip?: string;
containerStyles?: React.CSSProperties;
tooltipStyles?: React.CSSProperties;
anchorStyles?: React.CSSProperties;
}): JSX.Element => {
const [showCopied, setShowCopied] = React.useState(false);
const [showTooltip, setShowTooltip] = React.useState(false);
Expand Down Expand Up @@ -112,6 +114,7 @@ const CopyMailTo = ({
onFocus={displayTooltip}
onBlur={hideTooltip}
href={`mailto:${email}`}
style={anchorStyles}
>
{children || email}
</a>
Expand Down

0 comments on commit 16a9ba2

Please sign in to comment.