Skip to content

Commit

Permalink
feat: allow drag & drop tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 committed Aug 29, 2021
1 parent 47013b4 commit 94587b7
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 167 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
"license": "MIT",
"dependencies": {
"@logseq/libs": "^0.0.1-alpha.26",
"@use-gesture/react": "^10.0.0-beta.22",
"eslint-plugin-react-hooks": "^4.2.0",
"keyboardjs": "^2.6.4",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-spring": "^9.2.4",
"react-use": "^17.2.4"
},
"devDependencies": {
Expand Down
155 changes: 6 additions & 149 deletions pnpm-lock.yaml

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

4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ UX is mainly brought from morden browsers:
- if you click a page link while holding CTRL(or CMD on Mac) key, a new tab will be created (not visied yet)
- you can remove the tab by click the remove button in each tab
- you can double-click a tab to pin it. A pined tab will not be replaced or be removed.
- you can drag & drop to reorder tabs

## TODO
- [ ] Drag and drop tabs
- [ ] Transitions
- [ ] keyboard shortcuts. Eg., CTRL+TAB to switch to next tab, CTRL+SHIFT+TAB to switch to previous tab, CTRL+W to close current tab

![](./demo.gif)
6 changes: 5 additions & 1 deletion src/PageTabs.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.logseq-tab {
@apply cursor-pointer font-sans select-none text-xs h-6 transition
@apply cursor-pointer font-sans select-none text-xs h-6 transition-all
flex items-center rounded mx-0.5
px-2 light:text-black dark:text-white;
}
Expand All @@ -13,6 +13,10 @@
@apply light:bg-cool-gray-300 dark:bg-cool-gray-900;
}

.logseq-tab[data-dragging="true"] {
@apply ring-1 ring-red-500 mx-6;
}

.logseq-tab-title {
@apply overflow-ellipsis max-w-80 px-1 overflow-hidden whitespace-nowrap inline transition-all duration-200 ease-in-out;
}
Expand Down
Loading

0 comments on commit 94587b7

Please sign in to comment.