diff --git a/pages/app/components/header.scss b/pages/app/components/header.scss
index 379790ef35..86755e6980 100644
--- a/pages/app/components/header.scss
+++ b/pages/app/components/header.scss
@@ -27,3 +27,9 @@
color: #eee;
}
}
+
+/* stylelint-disable */
+body[data-hide-header='true'] .header {
+ display: none;
+}
+/* stylelint-enable */
diff --git a/pages/app/components/theme-switcher.tsx b/pages/app/components/theme-switcher.tsx
index 14e4322d23..4e74d4cb12 100644
--- a/pages/app/components/theme-switcher.tsx
+++ b/pages/app/components/theme-switcher.tsx
@@ -1,6 +1,6 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
-import React, { useContext } from 'react';
+import React, { useContext, useEffect } from 'react';
import { Density, Mode } from '@cloudscape-design/global-styles';
@@ -28,6 +28,78 @@ export default function ThemeSwitcher() {
};
}
+ useEffect(() => {
+ let keyPressed: any = {};
+
+ const handleKeyDown = (e: any) => {
+ keyPressed[e.key + e.location] = true;
+
+ if (keyPressed.Control1 === true && (keyPressed.d0 || keyPressed.x0) === true) {
+ // Left shift+CONTROL pressed!
+ if (mode === 'dark') {
+ setMode(Mode.Light);
+ keyPressed = {}; // reset key map
+ } else if (mode === 'light') {
+ setMode(Mode.Dark);
+ keyPressed = {}; // reset key map
+ }
+ }
+
+ if (keyPressed.Control1 === true && keyPressed.c0 === true) {
+ e.preventDefault();
+ if (urlParams.density === 'comfortable') {
+ setUrlParams({ density: Density.Compact });
+ } else if (urlParams.density === 'compact') {
+ setUrlParams({ density: Density.Comfortable });
+ }
+ keyPressed = {}; // reset key map
+ }
+
+ if (keyPressed.Control1 === true && keyPressed.m0 === true) {
+ e.preventDefault();
+ setUrlParams({ motionDisabled: !urlParams.motionDisabled });
+ keyPressed = {}; // reset key map
+ }
+
+ if (keyPressed.Control1 === true && keyPressed.r0 === true) {
+ e.preventDefault();
+ document.documentElement.setAttribute('dir', 'rtl');
+ keyPressed = {}; // reset key map
+ }
+
+ if (keyPressed.Control1 === true && keyPressed.l0 === true) {
+ e.preventDefault();
+ document.documentElement.setAttribute('dir', 'ltr');
+ keyPressed = {}; // reset key map
+ }
+
+ if (keyPressed.Control1 === true && keyPressed.v0 === true) {
+ e.preventDefault();
+ if (ALWAYS_VISUAL_REFRESH) {
+ setUrlParams({ visualRefresh: true });
+ } else {
+ setUrlParams({ visualRefresh: !urlParams.visualRefresh });
+ window.location.reload();
+ }
+ keyPressed = {}; // reset key map
+ }
+ };
+
+ const handleKeyUp = (e: any) => {
+ keyPressed[e.key + e.location] = false;
+
+ keyPressed = {};
+ };
+
+ document.addEventListener('keydown', handleKeyDown);
+ document.addEventListener('keyup', handleKeyUp);
+
+ return () => {
+ document.removeEventListener('keydown', handleKeyDown);
+ document.removeEventListener('keyup', handleKeyUp);
+ };
+ }, [mode, urlParams.density, urlParams.motionDisabled, urlParams.visualRefresh, setMode, setUrlParams]);
+
return (
+ }
+ >
+
+
+ );
+}
diff --git a/pages/keyboard-shortcut-hackathon/kvp-table.tsx b/pages/keyboard-shortcut-hackathon/kvp-table.tsx
new file mode 100644
index 0000000000..7e6d56ef57
--- /dev/null
+++ b/pages/keyboard-shortcut-hackathon/kvp-table.tsx
@@ -0,0 +1,32 @@
+// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+// SPDX-License-Identifier: Apache-2.0
+import React from 'react';
+
+import { Box, ExpandableSection } from '~components';
+
+import styles from './styles.scss';
+
+interface KeyValuePairProps {
+ items: Array<{
+ key: string;
+ value: string;
+ }>;
+ header?: string;
+}
+
+function KeyValuePairTable(props: KeyValuePairProps) {
+ return (
+
+ {props.items.map((item, index) => (
+
+
{item.key}
+
+ {item.value}
+
+
+ ))}
+
+ );
+}
+
+export default KeyValuePairTable;
diff --git a/pages/keyboard-shortcut-hackathon/shortcut-page.page.tsx b/pages/keyboard-shortcut-hackathon/shortcut-page.page.tsx
new file mode 100644
index 0000000000..5bc33a904c
--- /dev/null
+++ b/pages/keyboard-shortcut-hackathon/shortcut-page.page.tsx
@@ -0,0 +1,235 @@
+// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+// SPDX-License-Identifier: Apache-2.0
+import React, { useState } from 'react';
+
+import { Button, Container, Header, Select, SpaceBetween, StatusIndicator, Table } from '~components';
+
+import CustomAppLayout from './app-layout';
+import { shortcuts } from './shortcuts';
+
+import styles from './styles.scss';
+
+export default function ShortcutPage() {
+ const [selectedItems, setSelectedItems] = useState([]);
+ const [submitting, setSubmitting] = useState(false);
+ const [splitPanelOpen, setSplitPanelOpen] = useState(false);
+
+ const [tableItems, setTableItems] = useState(shortcuts);
+ const [customItems, setCustomItems] = useState([]);
+
+ const removeFiles = () => {
+ const newValue = customItems.filter(file => !selectedItems.includes(file));
+ setCustomItems(newValue);
+
+ setSelectedItems([]);
+ };
+
+ const handleSubmit = async (currentItem: any, column: any, value: any) => {
+ setSubmitting(true);
+ await new Promise(resolve => setTimeout(resolve, 1000));
+ const fullCollection = tableItems;
+
+ const newItem = { ...currentItem, [column.id]: value };
+
+ setTableItems(fullCollection.map(item => (item === currentItem ? newItem : item)));
+ setSubmitting(false);
+ };
+
+ console.log(customItems);
+
+ return (
+
+ Save
+
+ }
+ >
+ Keyboard shortcuts
+
+ }
+ customItems={customItems}
+ setCustomItems={setCustomItems}
+ >
+
+ Default shortcuts}>
+ setSelectedItems(detail.selectedItems)}
+ //selectedItems={selectedItems}
+ trackBy="name"
+ columnDefinitions={[
+ {
+ id: 'name',
+ header: 'Action name',
+ cell: item => item.name || '-',
+ sortingField: 'name',
+ isRowHeader: true,
+ },
+ {
+ id: 'type',
+ header: 'Shortcut',
+ cell: item => {item.shortcut} || '-',
+ sortingField: 'alt',
+ },
+ {
+ id: 'status',
+ header: 'Status',
+ cell: item =>
+ (
+
+ {item.status}
+
+ ) || '-',
+ editConfig: {
+ ariaLabel: 'Type',
+ editIconAriaLabel: 'editable',
+ editingCell: (item, { currentValue, setValue }) => {
+ const value = currentValue ?? item.status;
+ return (
+