-
Notifications
You must be signed in to change notification settings - Fork 170
/
Copy pathfull-page-table.page.tsx
68 lines (61 loc) · 2.37 KB
/
full-page-table.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
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
import React, { useContext, useState } from 'react';
import { AppLayoutToolbar, Button, Header, Link, Table } from '~components';
import AppContext, { AppContextType } from '../app/app-context';
import { Breadcrumbs, Footer, Navigation, Notifications, Tools } from '../app-layout/utils/content-blocks';
import labels from '../app-layout/utils/labels';
import * as toolsContent from '../app-layout/utils/tools-content';
import { generateItems, Instance } from '../table/generate-data';
import { columnsConfig } from '../table/shared-configs';
import ScreenshotArea from '../utils/screenshot-area';
type PageContext = React.Context<AppContextType<{ stickyNotifications: boolean }>>;
const items = generateItems(20);
export default function () {
const [toolsOpen, setToolsOpen] = useState(false);
const [selectedTool, setSelectedTool] = useState<keyof typeof toolsContent>('long');
const { urlParams } = useContext(AppContext as PageContext);
function openHelp(article: keyof typeof toolsContent) {
setToolsOpen(true);
setSelectedTool(article);
}
return (
<ScreenshotArea gutters={false}>
<AppLayoutToolbar
ariaLabels={labels}
breadcrumbs={<Breadcrumbs />}
navigation={<Navigation />}
contentType="table"
tools={<Tools>{toolsContent[selectedTool]}</Tools>}
toolsOpen={toolsOpen}
onToolsChange={({ detail }) => setToolsOpen(detail.open)}
notifications={<Notifications />}
stickyNotifications={urlParams.stickyNotifications}
content={
<Table<Instance>
header={
<Header
variant="awsui-h1-sticky"
description="Demo page with footer"
info={
<Link variant="info" onFollow={() => openHelp('long')}>
Long help text
</Link>
}
actions={<Button variant="primary">Create</Button>}
>
Sticky Scrollbar Example
</Header>
}
stickyHeader={true}
variant="full-page"
columnDefinitions={columnsConfig}
items={items}
stripedRows={true}
/>
}
/>
<Footer legacyConsoleNav={false} />
</ScreenshotArea>
);
}