-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tip: Covert component to TypeScript (#42262)
* Tip: Covert component to TypeScript * Update CHANGELOG.md
- Loading branch information
Petter Walbø Johnsgård
authored
Jul 9, 2022
1 parent
54c90b7
commit 66bd34a
Showing
6 changed files
with
67 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Icon, tip } from '@wordpress/icons'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { TipProps } from './types'; | ||
|
||
export function Tip( props: TipProps ) { | ||
const { children } = props; | ||
|
||
return ( | ||
<div className="components-tip"> | ||
<Icon icon={ tip } /> | ||
<p>{ children }</p> | ||
</div> | ||
); | ||
} | ||
|
||
export default Tip; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Tip from '..'; | ||
|
||
const meta: ComponentMeta< typeof Tip > = { | ||
component: Tip, | ||
title: 'Components/Tip', | ||
argTypes: { | ||
children: { control: { type: 'text' } }, | ||
}, | ||
parameters: { | ||
controls: { | ||
expanded: true, | ||
}, | ||
docs: { source: { state: 'open' } }, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
const Template: ComponentStory< typeof Tip > = ( args ) => { | ||
return <Tip { ...args } />; | ||
}; | ||
|
||
export const Default: ComponentStory< typeof Tip > = Template.bind( {} ); | ||
Default.args = { | ||
children: 'An example tip', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import type { ReactNode } from 'react'; | ||
|
||
export type TipProps = { | ||
/** | ||
* Children to render in the tip. | ||
*/ | ||
children: ReactNode; | ||
}; |