Skip to content

Commit

Permalink
fix: expand hint props to be anything off of base props
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Webb authored and Brandon Webb committed Sep 20, 2021
1 parent 2283e4b commit c9d4dd2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/hint/DefaultHint.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { memo } from 'react';
import { HTMLProps, memo } from 'react';
import type { HintProps } from 'src/types';

export const DefaultHint = memo((props: HintProps<HTMLDivElement>): JSX.Element => {
export type PropTypes = HintProps & HTMLProps<HTMLDivElement>;

export const DefaultHint = memo((props: PropTypes): JSX.Element => {
const {
isMouseDetected,
isTouchDetected,
Expand Down
8 changes: 5 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ export interface LensProps extends HTMLProps<HTMLDivElement> {
position: Point;
}

export interface HintProps<T extends HTMLElement = any> extends Partial<Omit<HTMLProps<T>, 'ref'>> {
export interface HintProps {
isMouseDetected?: boolean;
isTouchDetected?: boolean;
hintTextMouse: string;
hintTextTouch: string;
style?: CSSProperties | null;
}

export type PortalProps = Omit<Partial<Options>, 'modifiers' | 'placement'> & {
Expand Down Expand Up @@ -127,6 +128,7 @@ export interface CursorPositionProps extends HTMLProps<HTMLDivElement> {
tapDurationInMs?: number;
tapMoveThreshold?: number;
}

export interface ReactImageMagnifyProps extends Omit<
CursorPositionProps,
'activationInteractionMouse' | 'activationInteractionTouch' | 'children'
Expand All @@ -135,8 +137,8 @@ CursorPositionProps,
activationInteractionMouse?: Interactions['click'] | Interactions['hover'];
activationInteractionTouch?: Interactions['press'] | Interactions['tap'] | Interactions['touch'];
fadeDurationInMs?: number;
hintComponent?: ComponentType<HintProps>;
hintProps?: HintProps;
hintComponent?: ComponentType<HintProps & any>;
hintProps?: HintProps & any;
hoverDelayInMs?: number;
hoverOffDelayInMs?: number;
imageComponent?: ComponentType<HTMLProps<HTMLImageElement>>;
Expand Down

0 comments on commit c9d4dd2

Please sign in to comment.