Skip to content

Commit 03eb8db

Browse files
committed
export new widgetized parts
1 parent 4ccda87 commit 03eb8db

File tree

75 files changed

+3455
-2903
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+3455
-2903
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
{
168168
"path": "lib/components/internal/widget-exports.js",
169169
"brotli": false,
170-
"limit": "810 kB",
170+
"limit": "830 kB",
171171
"ignore": "react-dom"
172172
}
173173
],

pages/app-layout/runtime-drawers.page.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
3-
import React, { useContext, useEffect, useRef, useState } from 'react';
3+
import React, { useContext, useRef, useState } from 'react';
44

55
import {
66
AppLayout,
@@ -31,18 +31,6 @@ type DemoContext = React.Context<
3131
}>
3232
>;
3333

34-
const CustomContent = () => {
35-
useEffect(() => {
36-
console.log('mount');
37-
38-
return () => {
39-
console.log('unmount');
40-
};
41-
}, []);
42-
43-
return <div>Custom content</div>;
44-
};
45-
4634
export default function WithDrawers() {
4735
const [activeDrawerId, setActiveDrawerId] = useState<string | null>(null);
4836
const [helpPathSlug, setHelpPathSlug] = useState<string>('default');
@@ -158,7 +146,6 @@ export default function WithDrawers() {
158146
>
159147
Content
160148
</Header>
161-
<CustomContent />
162149
<Containers />
163150
</ContentLayout>
164151
</div>

pages/utils/iframe-wrapper.tsx

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,35 @@ export function IframeWrapper({ id, AppComponent }: { id: string; AppComponent:
3232
const ref = useRef<HTMLDivElement>(null);
3333

3434
useEffect(() => {
35-
setTimeout(() => {
36-
const container = ref.current;
37-
if (!container) {
38-
return;
39-
}
40-
const iframeEl = container.ownerDocument.createElement('iframe');
41-
iframeEl.className = styles['full-screen'];
42-
iframeEl.id = id;
43-
iframeEl.title = id;
44-
container.appendChild(iframeEl);
35+
const container = ref.current;
36+
if (!container) {
37+
return;
38+
}
39+
const iframeEl = container.ownerDocument.createElement('iframe');
40+
iframeEl.className = styles['full-screen'];
41+
iframeEl.id = id;
42+
iframeEl.title = id;
43+
container.appendChild(iframeEl);
4544

46-
const iframeDocument = iframeEl.contentDocument!;
47-
// Prevent iframe document instance from reload
48-
// https://bugzilla.mozilla.org/show_bug.cgi?id=543435
49-
iframeDocument.open();
50-
// set html5 doctype
51-
iframeDocument.writeln('<!DOCTYPE html>');
52-
iframeDocument.close();
45+
const iframeDocument = iframeEl.contentDocument!;
46+
// Prevent iframe document instance from reload
47+
// https://bugzilla.mozilla.org/show_bug.cgi?id=543435
48+
iframeDocument.open();
49+
// set html5 doctype
50+
iframeDocument.writeln('<!DOCTYPE html>');
51+
iframeDocument.close();
5352

54-
const innerAppRoot = iframeDocument.createElement('div');
55-
iframeDocument.body.appendChild(innerAppRoot);
56-
copyStyles(document, iframeDocument);
57-
iframeDocument.dir = document.dir;
58-
const syncClassesCleanup = syncClasses(document.body, iframeDocument.body);
59-
ReactDOM.render(<AppComponent />, innerAppRoot);
60-
return () => {
61-
syncClassesCleanup();
62-
ReactDOM.unmountComponentAtNode(innerAppRoot);
63-
container.removeChild(iframeEl);
64-
};
65-
}, 50);
53+
const innerAppRoot = iframeDocument.createElement('div');
54+
iframeDocument.body.appendChild(innerAppRoot);
55+
copyStyles(document, iframeDocument);
56+
iframeDocument.dir = document.dir;
57+
const syncClassesCleanup = syncClasses(document.body, iframeDocument.body);
58+
ReactDOM.render(<AppComponent />, innerAppRoot);
59+
return () => {
60+
syncClassesCleanup();
61+
ReactDOM.unmountComponentAtNode(innerAppRoot);
62+
container.removeChild(iframeEl);
63+
};
6664
}, [id, AppComponent]);
6765

6866
return <div ref={ref}></div>;

src/app-layout/__integ__/awsui-applayout.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ describe.each(['classic', 'refresh', 'refresh-toolbar'] as Theme[])('%s', theme
199199
})
200200
);
201201

202-
(theme !== 'classic' ? test : test.skip)(
202+
(theme !== 'classic' ? test.skip : test.skip)(
203203
'element should not be hidden under the sticky header when focused',
204204
setupTest({ pageName: 'global-scroll-padding' }, async page => {
205205
// Getting the header offset depending on the theme

0 commit comments

Comments
 (0)