-
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.
SandBox: Convert to TypeScript (#46478)
* Rename files * Fix inconsistent capitalization The public export is capitalized as "SandBox" * Add types * Add TODO to remove WP coupling * Add stories * Copy props to readme * Add main JSDoc * Add changelog * Update changelog
- Loading branch information
Showing
7 changed files
with
168 additions
and
31 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 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 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 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,32 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import type { ComponentMeta, ComponentStory } from '@storybook/react'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import SandBox from '..'; | ||
|
||
const meta: ComponentMeta< typeof SandBox > = { | ||
component: SandBox, | ||
title: 'Components/SandBox', | ||
argTypes: { | ||
onFocus: { control: { type: null } }, | ||
}, | ||
parameters: { | ||
actions: { argTypesRegex: '^on.*' }, | ||
controls: { expanded: true }, | ||
docs: { source: { state: 'open' } }, | ||
}, | ||
}; | ||
export default meta; | ||
|
||
const Template: ComponentStory< typeof SandBox > = ( args ) => ( | ||
<SandBox { ...args } /> | ||
); | ||
|
||
export const Default = Template.bind( {} ); | ||
Default.args = { | ||
html: '<p>Arbitrary HTML content</p>', | ||
}; |
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 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,34 @@ | ||
export type SandBoxProps = { | ||
/** | ||
* The HTML to render in the body of the iframe document. | ||
* | ||
* @default '' | ||
*/ | ||
html?: string; | ||
/** | ||
* The `<title>` of the iframe document. | ||
* | ||
* @default '' | ||
*/ | ||
title?: string; | ||
/** | ||
* The CSS class name to apply to the `<html>` and `<body>` elements of the iframe. | ||
*/ | ||
type?: string; | ||
/** | ||
* An array of CSS strings to inject into the `<head>` of the iframe document. | ||
* | ||
* @default [] | ||
*/ | ||
styles?: string[]; | ||
/** | ||
* An array of script URLs to inject as `<script>` tags into the bottom of the `<body>` of the iframe document. | ||
* | ||
* @default [] | ||
*/ | ||
scripts?: string[]; | ||
/** | ||
* The `onFocus` callback for the iframe. | ||
*/ | ||
onFocus?: React.DOMAttributes< HTMLIFrameElement >[ 'onFocus' ]; | ||
}; |
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
980100c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 980100c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/3859604890
📝 Reported issues:
Browse all
#45332 inspecs/editor/various/inserting-blocks.test.js
specs/editor/various/block-deletion.test.js
specs/editor/various/multi-block-selection.test.js
specs/editor/plugins/custom-post-types.test.js