Skip to content

Commit

Permalink
fix: remove defaultProps from DatePicker and Tooltip (#2949)
Browse files Browse the repository at this point in the history
  • Loading branch information
aligg authored Jul 18, 2024
1 parent 00950d7 commit 88947ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
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,
}

0 comments on commit 88947ca

Please sign in to comment.