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 2 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
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ This project does _not_ adhere to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html) but contrary to it
every new version is a new major version.

## 195.0.0 - unreleased

### Changed

- Improved shortcuts modal layout and look.

## 194.0.0 - 2024-12-17

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "194.0.0",
"version": "195.0.0",
"description": "Shared commodities for developing pc-nrfconnect-* packages",
"repository": {
"type": "git",
Expand Down
33 changes: 23 additions & 10 deletions src/Shortcuts/Shortcut-item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,39 @@
@import '../variables.scss';

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

padding-top: 4px;
overflow: auto;

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

.shortcut-title {
display: inline;
padding-top: 4px;
}

.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.

6 changes: 1 addition & 5 deletions src/Shortcuts/ShortcutItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const ShortcutItem: FC<Props> = ({ title, hotKey }) => {

return (
<div className="shortcut-item">
<h5 className="shortcut-title">{title}</h5>
<h5 className="shortcut-title">{title}:</h5>
KievDevel marked this conversation as resolved.
Show resolved Hide resolved
<div className="shortcuts">
{shortcutComboKeys.map(shortcutKeys => (
<div
Expand All @@ -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