-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(HotkeysPanel): add hotkeys panel docs
- Loading branch information
kseniyakuzina
committed
Sep 25, 2024
1 parent
ac8d206
commit 81aaeb9
Showing
6 changed files
with
168 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/content/components/navigation/HotkeysPanel/HotkeysPanelComponent.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/content/components/navigation/HotkeysPanel/HotkeysPanelComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
75
src/content/components/navigation/HotkeysPanel/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}, | ||
}, | ||
}, | ||
}; |