-
Notifications
You must be signed in to change notification settings - Fork 170
/
Copy pathperformance-marks.page.tsx
89 lines (77 loc) · 2.7 KB
/
performance-marks.page.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React, { useState } from 'react';
import { Button, Header, Link, Modal, SpaceBetween, Table, Tabs } from '~components';
import Box from '~components/box';
import { useAppContext } from '../app/app-context';
const EVALUATE_COMPONENT_VISIBILITY_EVENT = 'awsui-evaluate-component-visibility';
export default function TablePerformanceMarkPage() {
const [loading, setLoading] = useState(true);
const { outsideOfViewport } = useAppContext<'outsideOfViewport'>().urlParams;
const dispatchEvaluateVisibilityEvent = () => {
const event = new CustomEvent(EVALUATE_COMPONENT_VISIBILITY_EVENT);
setTimeout(() => {
document.dispatchEvent(event);
}, 0);
};
return (
<Box padding="xxl">
<h1>Performance marks in table</h1>
<SpaceBetween size="xxl">
<label>
<input type="checkbox" checked={loading} onChange={e => setLoading(e.target.checked)} id="loading" />
Loading
</label>
<label>
<Button onClick={() => dispatchEvaluateVisibilityEvent()} id="evaluateComponentVisibility">
Dispatch EvaluateVisibility Event
</Button>
</label>
{outsideOfViewport && (
<div
style={{
margin: 3,
padding: 10,
border: '1px solid rgba(128 128 128 / 50%)',
background: 'rgba(128 128 128 / 10%)',
height: '100vh',
}}
>
The Table is rendered below the viewport
</div>
)}
<Table
items={[]}
loading={loading}
columnDefinitions={[]}
header={<Header info={<Link variant="info">Info</Link>}>This is my table</Header>}
/>
<Table items={[]} columnDefinitions={[]} header="A table without the Header component" />
<Modal visible={false}>
<Table items={[]} columnDefinitions={[]} header="A table inside a Modal" />
</Modal>
<Tabs
tabs={[
{
label: 'An empty tab',
id: 'first',
content: "There is nothing in this tab, but there's a table in the other tab.",
},
{
label: 'A tab with a table',
id: 'second',
content: (
<Table
items={[]}
loading={loading}
columnDefinitions={[]}
header={<Header info={<Link variant="info">Info</Link>}>This is the table in the tab.</Header>}
/>
),
},
]}
/>
</SpaceBetween>
</Box>
);
}