Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,18 @@ export function isCustomProps<T>(
}

const TRIANGLE_SIZE = 5
const DEFAULT_POSITION = 'top'

export function Tooltip(props: DefaultTooltipProps): ReactElement
export function Tooltip<T>(props: CustomTooltipProps<T>): ReactElement
export function Tooltip<
FCProps extends React.PropsWithChildren<object> = DefaultTooltipProps,
>(props: DefaultTooltipProps | CustomTooltipProps<FCProps>): ReactElement {
>({
position = DEFAULT_POSITION,
wrapperclasses,
className,
...props
}: DefaultTooltipProps | CustomTooltipProps<FCProps>): ReactElement {
const triggerElementRef = useRef<HTMLElement & HTMLButtonElement>(null)
const tooltipBodyRef = useRef<HTMLElement>(null)
const tooltipID = useRef(
Expand All @@ -56,8 +62,6 @@ export function Tooltip<
const [wrapTooltip, setWrapTooltip] = useState(false)
const [positionStyles, setPositionStyles] = useState({})

const { position, wrapperclasses, className } = props

const positionTop = (e: HTMLElement, triggerEl: HTMLElement): void => {
const topMargin = calculateMarginOffset('top', e.offsetHeight, triggerEl)
const leftMargin = calculateMarginOffset('left', e.offsetWidth, triggerEl)
Expand Down Expand Up @@ -287,7 +291,3 @@ export function Tooltip<
)
}
}

Tooltip.defaultProps = {
position: 'top',
}
4 changes: 0 additions & 4 deletions src/components/forms/DatePicker/DatePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,3 @@ export const DatePicker = ({
</div>
)
}

DatePicker.defaultProps = {
minDate: DEFAULT_MIN_DATE,
}
Loading