Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve shortcuts modal layout & look #961

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ every new version is a new major version.

## 197.0.0 - unreleased

### Changed

- Improved shortcuts modal layout and look.

### Fixed

- Show log shortcut now works every time it is called.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@nordicsemiconductor/pc-nrfconnect-shared",
"version": "196.0.0",
"version": "197.0.0",
"description": "Shared commodities for developing pc-nrfconnect-* packages",
"repository": {
"type": "git",
Expand Down
38 changes: 29 additions & 9 deletions src/Shortcuts/Shortcut-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,46 @@
@import '../variables.scss';

.shortcut-item {
border-top: 1px solid $gray-100;
display: flex;
gap: 8px;

padding-top: 20px;
margin-bottom: 6px;
overflow: auto;

display: flex;
justify-content: space-between;

&:not(:first-of-type) {
border-top: 1px solid $gray-100;
}

&:first-of-type {
margin-top: 24px;
}

.shortcut-title {
display: inline;
// display: inline;
padding-top: 4px;
// width: 140px;
}
.shortcuts {
float: right;
.shortcut-element {
display: 'block';
margin-bottom: 20px;
display: flex;
gap: 6px;
margin-bottom: 16px;

.shortcut-span {
background-color: $gray-100;
padding: 8px;
border-radius: 5px;
box-shadow: 0 2px $gray-200;
text-transform: capitalize;
background-color: $gray-50;
padding: 4px 10px;
border-radius: 4px;
box-shadow: 0 2px $gray-100;
}
.separator-span {
background-color: $white;
padding: 8px;
padding: 4px 10px;
}
}
}
Expand Down
20 changes: 0 additions & 20 deletions src/Shortcuts/Shortcut-modal.scss

This file was deleted.

4 changes: 0 additions & 4 deletions src/Shortcuts/ShortcutItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ const ShortcutItem: FC<Props> = ({ title, hotKey }) => {
<span className="shortcut-span">
{shortcutKey}
</span>
{shortcutKey !==
shortcutKeys[shortcutKeys.length - 1] && (
<span className="separator-span">+</span>
)}
</span>
))}
</div>
Expand Down
55 changes: 24 additions & 31 deletions src/Shortcuts/ShortcutModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
*/

import React, { FC } from 'react';
import Modal from 'react-bootstrap/Modal';
import { useSelector } from 'react-redux';

import { globalShortcuts, localShortcuts } from '../About/shortcutSlice';
import { DialogButton, GenericDialog as Dialog } from '../Dialog/Dialog';
import ShortcutItem from './ShortcutItem';

import './Shortcut-modal.scss';

export interface Props {
isVisible: boolean;
onCancel: () => void;
Expand All @@ -23,44 +21,39 @@ const ShortcutModal: FC<Props> = ({ isVisible, onCancel }) => {
const global = useSelector(globalShortcuts);

return (
<Modal
show={isVisible}
<Dialog
title="Shortcuts"
closeOnEsc
isVisible={isVisible}
onHide={onCancel}
size="lg"
className="shortcut-modal"
size="m"
footer={<DialogButton onClick={onCancel}>Close</DialogButton>}
>
<Modal.Header closeButton>
<Modal.Title>
<h3>Shortcuts</h3>
</Modal.Title>
</Modal.Header>
<Modal.Body className="shortcut-lists">
<>
{local.length > 0 && (
<div>
<h4 className="list-header">In this app</h4>
{local.map(shortcut => (
<ShortcutItem
key={shortcut.title}
title={shortcut.title}
hotKey={shortcut.hotKey}
/>
))}
</div>
)}
<>
{local.length > 0 && (
<div>
<h4 className="list-header">In all apps</h4>
{global.map(shortcut => (
<h4 className="list-header">In this app</h4>
{local.map(shortcut => (
<ShortcutItem
key={shortcut.title}
title={shortcut.title}
hotKey={shortcut.hotKey}
/>
))}
</div>
</>
</Modal.Body>
</Modal>
)}
<div>
<h4 className="list-header">In all apps</h4>
{global.map(shortcut => (
<ShortcutItem
key={shortcut.title}
title={shortcut.title}
hotKey={shortcut.hotKey}
/>
))}
</div>
</>
</Dialog>
);
};

Expand Down