Skip to content

Commit

Permalink
feat(HotkeysPanel): add hotkeys panel docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kseniyakuzina committed Sep 25, 2024
1 parent ac8d206 commit 81aaeb9
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 7 deletions.
9 changes: 4 additions & 5 deletions 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
Expand Up @@ -10,7 +10,7 @@
"@gravity-ui/date-components": "^2.10.1",
"@gravity-ui/icons": "^2.11.0",
"@gravity-ui/markdown-editor": "^13.18.0",
"@gravity-ui/navigation": "^2.23.1",
"@gravity-ui/navigation": "^2.24.0",
"@gravity-ui/page-constructor": "^5.2.0",
"@gravity-ui/uikit": "^6.27.2",
"@mdx-js/mdx": "^2.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@use '../../../../variables';

$block: '.#{variables.$ns}hotkeys-panel';

#{$block} {
&__title {
display: flex;
gap: var(--g-spacing-2);
align-items: baseline;
}

&__empty {
margin: var(--g-spacing-10) auto 0;
color: var(--g-color-text-primary);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {HotkeysPanel} from '@gravity-ui/navigation';
import {Hotkey, Text} from '@gravity-ui/uikit';
import React from 'react';

import {block} from '../../../../utils';

import './HotkeysPanelComponent.scss';
import {hotkeys} from './constants';

const b = block('hotkeys-panel');

type HotkeysPanelComponentProps = {
visible: boolean;
filterable: boolean;
filterPlaceholder: string;
};

export function HotkeysPanelComponent({
visible,
filterable,
filterPlaceholder,
}: HotkeysPanelComponentProps) {
return (
<HotkeysPanel
hotkeys={hotkeys}
visible={visible}
filterable={filterable}
title={
<span className={b('title')}>
Hotkeys
<Hotkey value="shift+K" />
</span>
}
filterPlaceholder={filterPlaceholder}
emptyState={
<Text variant="header-1" className={b('empty')}>
No hotkeys found
</Text>
}
/>
);
}
75 changes: 75 additions & 0 deletions src/content/components/navigation/HotkeysPanel/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import {HotkeysGroup} from '@gravity-ui/navigation';

export const hotkeys: HotkeysGroup[] = [
{
title: 'General',
items: [
{
title: 'Copy',
value: 'ctrl+c',
},
{
title: 'Paste',
value: 'ctrl+v',
},
],
},
{
title: 'Issue',
items: [
{
title: 'Go to comments',
value: 'shift+c',
},
{
title: 'Go to history',
value: 'shift+h',
},
{
title: 'Go to attachments',
value: 'shift+a',
},
{
title: 'Edit description',
value: 'alt+d',
},
{
title: 'Add new comment',
value: 'alt+c',
},
{
title: 'Edit assignee',
value: 'alt+e',
},
{
title: 'Edit watchers',
value: 'alt+w',
},
{
title: 'Assignee me',
value: 'm',
},
{
title: 'Add me to watchers',
value: 'w',
},
],
},
{
title: 'Board',
items: [
{
title: 'Activate grouping select',
value: 'alt+g',
},
{
title: 'Activate sorting select',
value: 'alt+s',
},
{
title: 'Go to the backlog',
value: 'shift+b',
},
],
},
];
31 changes: 30 additions & 1 deletion src/content/components/navigation/HotkeysPanel/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
import dynamic from 'next/dynamic';

import {Repos} from '../../../../types/common';
import {Component} from '../../types';
import {getGithubUrl, getReadmeUrl} from '../../utils';

const getterOptions = {repoName: Repos.Navigation, componentName: 'HotkeysPanel'};

export const hotkeysPanelConfig: Component = {
id: 'hotkeys-panel',
title: 'Hotkeys Panel',
isComingSoon: true,
githubUrl: getGithubUrl(getterOptions),
content: {
readmeUrl: getReadmeUrl(getterOptions),
},
sandbox: {
expandedContainer: true,
component: dynamic(() =>
import('./HotkeysPanelComponent').then((mod) => mod.HotkeysPanelComponent),
),
props: {
visible: {
type: 'switch',
defaultValue: true,
},
filterable: {
type: 'switch',
defaultValue: true,
},
filterPlaceholder: {
type: 'input',
defaultValue: 'Search',
},
},
},
};

0 comments on commit 81aaeb9

Please sign in to comment.