Skip to content

Commit

Permalink
fixed react 18 types
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeniy-ferapontov committed May 25, 2022
1 parent 56bc3c8 commit 741efd8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/email.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { LinkProps } from "types";
export const emailRegex =
/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/;

export const EmailComponent: React.FC<LinkProps> = ({ match, className }) => {
export const EmailComponent: React.FC<React.PropsWithChildren<LinkProps>> = ({ match, className }) => {
return (
<a
className={className}
Expand Down
12 changes: 6 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ function findText(
* </LinkIt>
* ```
*/
export const LinkIt: React.FC<{
export const LinkIt: React.FC<React.PropsWithChildren<{
component: Component;
regex: RegExp;
}> = (props) => {
}>> = (props) => {
return (
<Fragment>
{findText(props.children, props.component, props.regex)}
Expand All @@ -108,7 +108,7 @@ export const LinkIt: React.FC<{
/**
* Link URLs
*/
export const LinkItUrl: React.FC<HOCLinkProps> = (props) => {
export const LinkItUrl: React.FC<React.PropsWithChildren<HOCLinkProps>> = (props) => {
return (
<Fragment>
{findText(
Expand All @@ -125,7 +125,7 @@ export const LinkItUrl: React.FC<HOCLinkProps> = (props) => {
/**
* Link Twitter handles
*/
export const LinkItTwitter: React.FC<HOCLinkProps> = (props) => {
export const LinkItTwitter: React.FC<React.PropsWithChildren<HOCLinkProps>> = (props) => {
return (
<Fragment>
{findText(
Expand All @@ -142,7 +142,7 @@ export const LinkItTwitter: React.FC<HOCLinkProps> = (props) => {
/**
* Link Jira tickets
*/
export const LinkItJira: React.FC<JiraHOCLinkProps> = (props) => {
export const LinkItJira: React.FC<React.PropsWithChildren<JiraHOCLinkProps>> = (props) => {
return (
<Fragment>
{findText(
Expand All @@ -159,7 +159,7 @@ export const LinkItJira: React.FC<JiraHOCLinkProps> = (props) => {
/**
* Link Emails
*/
export const LinkItEmail: React.FC<HOCLinkProps> = (props) => {
export const LinkItEmail: React.FC<React.PropsWithChildren<HOCLinkProps>> = (props) => {
return (
<Fragment>
{findText(
Expand Down
2 changes: 1 addition & 1 deletion src/jira.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { JiraLinkProps } from "types";

export const jiraRegex = /[A-Z]+-\d+/i;

export const JiraComponent: React.FC<JiraLinkProps> = ({
export const JiraComponent: React.FC<React.PropsWithChildren<JiraLinkProps>> = ({
match,
domain,
className,
Expand Down
2 changes: 1 addition & 1 deletion src/twitter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { LinkProps } from "types";

export const twitterRegex = /\B@([\w_]+)/;

export const TwitterComponent: React.FC<LinkProps> = ({ match, className }) => {
export const TwitterComponent: React.FC<React.PropsWithChildren<LinkProps>> = ({ match, className }) => {
return (
<a
className={className}
Expand Down
2 changes: 1 addition & 1 deletion src/url.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { LinkProps } from "types";
export const urlRegex =
/(https?:\/\/|www\.)([-\w.]+\/[\p{L}\p{Emoji}\p{Emoji_Component}!#$%&'"()*+,./\\:;=_?@[\]~-]*[^\s'",.;:\b)\]}?]|(([\w-]+\.)+[\w-]+[\w/-]))/u;

export const UrlComponent: React.FC<LinkProps> = ({ match: url, className }) => {
export const UrlComponent: React.FC<React.PropsWithChildren<LinkProps>> = ({ match: url, className }) => {
return (
<a
className={className}
Expand Down

0 comments on commit 741efd8

Please sign in to comment.