Skip to content

Commit 6c727af

Browse files
WesSouzaarturbien
authored andcommitted
feat(tooltip): convert to TypeScript and export types
This also adds utils to help identify React events for TypeScript.
1 parent 33f52e9 commit 6c727af

File tree

8 files changed

+394
-201
lines changed

8 files changed

+394
-201
lines changed

src/Tooltip/Tooltip.js

-191
This file was deleted.

src/Tooltip/Tooltip.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Tooltip
33
menu: Components
44
---
55

6-
import Tooltip from './Tooltip';
6+
import { Tooltip } from './Tooltip';
77
import { Button } from '../Button/Button';
88

99
# Tooltip

src/Tooltip/Tooltip.spec.js renamed to src/Tooltip/Tooltip.spec.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import React from 'react';
21
import { fireEvent, render, waitFor } from '@testing-library/react';
32

4-
import Tooltip from './Tooltip';
3+
import { Tooltip, TooltipProps } from './Tooltip';
54

6-
const getProps = (props = {}) => ({
5+
const getProps = (
6+
props: Partial<TooltipProps> = {}
7+
): Omit<TooltipProps, 'children'> => ({
78
className: props.className,
89
disableFocusListener: props.disableFocusListener,
910
disableMouseListener: props.disableMouseListener,
@@ -19,7 +20,7 @@ const getProps = (props = {}) => ({
1920
text: 'I am the tooltip'
2021
});
2122

22-
const renderTooltip = props => (
23+
const renderTooltip = (props: Omit<TooltipProps, 'children'>) => (
2324
<Tooltip {...props}>
2425
<div>Kid</div>
2526
</Tooltip>

src/Tooltip/Tooltip.stories.js renamed to src/Tooltip/Tooltip.stories.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import React from 'react';
1+
import { ComponentMeta } from '@storybook/react';
2+
import { Button, Tooltip } from 'react95';
23
import styled from 'styled-components';
34

4-
import { Tooltip, Button } from 'react95';
5-
65
const Wrapper = styled.div`
76
padding: 5rem;
87
background: ${({ theme }) => theme.desktopBackground};
@@ -12,7 +11,7 @@ export default {
1211
title: 'Tooltip',
1312
component: Tooltip,
1413
decorators: [story => <Wrapper>{story()}</Wrapper>]
15-
};
14+
} as ComponentMeta<typeof Tooltip>;
1615

1716
export function Default() {
1817
return (

0 commit comments

Comments
 (0)