mirror of
https://github.com/penpot/penpot.git
synced 2025-05-18 14:06:09 +02:00
✨ Add some enhancements to context menus
This commit is contained in:
parent
b547f1cd7e
commit
81a604dca2
8 changed files with 13 additions and 4 deletions
|
@ -41,6 +41,10 @@
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: 2px;
|
margin: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.min-width {
|
||||||
|
min-width: 13rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.context-menu-action {
|
.context-menu-action {
|
||||||
|
@ -72,8 +76,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&.submenu-back {
|
&.submenu-back {
|
||||||
color: $color-gray-30;
|
color: $color-black;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
font-weight: bold;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
& svg {
|
& svg {
|
||||||
|
|
|
@ -167,6 +167,7 @@
|
||||||
|
|
||||||
.shortcut {
|
.shortcut {
|
||||||
color: $color-gray-20;
|
color: $color-gray-20;
|
||||||
|
font-size: $fs12;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
span:last-child {
|
span:last-child {
|
||||||
color: $color-gray-20;
|
color: $color-gray-20;
|
||||||
|
font-size: $fs12;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
top (gobj/get props "top" 0)
|
top (gobj/get props "top" 0)
|
||||||
left (gobj/get props "left" 0)
|
left (gobj/get props "left" 0)
|
||||||
fixed? (gobj/get props "fixed?" false)
|
fixed? (gobj/get props "fixed?" false)
|
||||||
|
min-width? (gobj/get props "min-width?" false)
|
||||||
|
|
||||||
local (mf/use-state {:offset 0
|
local (mf/use-state {:offset 0
|
||||||
:levels nil})
|
:levels nil})
|
||||||
|
@ -89,7 +90,8 @@
|
||||||
:style {:top (+ top (:offset @local))
|
:style {:top (+ top (:offset @local))
|
||||||
:left left}}
|
:left left}}
|
||||||
(let [level (-> @local :levels peek)]
|
(let [level (-> @local :levels peek)]
|
||||||
[:ul.context-menu-items {:ref check-menu-offscreen}
|
[:ul.context-menu-items {:class (classnames :min-width min-width?)
|
||||||
|
:ref check-menu-offscreen}
|
||||||
(when-let [parent-option (:parent-option level)]
|
(when-let [parent-option (:parent-option level)]
|
||||||
[:*
|
[:*
|
||||||
[:li.context-menu-item
|
[:li.context-menu-item
|
||||||
|
|
|
@ -156,6 +156,7 @@
|
||||||
[:& context-menu {:on-close on-menu-close
|
[:& context-menu {:on-close on-menu-close
|
||||||
:show show?
|
:show show?
|
||||||
:fixed? (or (not= top 0) (not= left 0))
|
:fixed? (or (not= top 0) (not= left 0))
|
||||||
|
:min-width? true
|
||||||
:top top
|
:top top
|
||||||
:left left
|
:left left
|
||||||
:options [[(tr "dashboard.open-in-new-tab") on-new-tab]
|
:options [[(tr "dashboard.open-in-new-tab") on-new-tab]
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
[app.main.data.dashboard :as dd]
|
[app.main.data.dashboard :as dd]
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.context-menu :refer [context-menu]]
|
|
||||||
[app.main.ui.dashboard.grid :refer [grid]]
|
[app.main.ui.dashboard.grid :refer [grid]]
|
||||||
[app.main.ui.dashboard.inline-edition :refer [inline-edition]]
|
[app.main.ui.dashboard.inline-edition :refer [inline-edition]]
|
||||||
[app.main.ui.dashboard.project-menu :refer [project-menu]]
|
[app.main.ui.dashboard.project-menu :refer [project-menu]]
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
[app.main.data.modal :as modal]
|
[app.main.data.modal :as modal]
|
||||||
[app.main.fonts :as fonts]
|
[app.main.fonts :as fonts]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.components.context-menu :refer [context-menu]]
|
|
||||||
[app.main.ui.dashboard.file-menu :refer [file-menu]]
|
[app.main.ui.dashboard.file-menu :refer [file-menu]]
|
||||||
[app.main.ui.dashboard.inline-edition :refer [inline-edition]]
|
[app.main.ui.dashboard.inline-edition :refer [inline-edition]]
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
|
|
|
@ -96,6 +96,7 @@
|
||||||
[:& context-menu {:on-close on-menu-close
|
[:& context-menu {:on-close on-menu-close
|
||||||
:show show?
|
:show show?
|
||||||
:fixed? (or (not= top 0) (not= left 0))
|
:fixed? (or (not= top 0) (not= left 0))
|
||||||
|
:min-width? true
|
||||||
:top top
|
:top top
|
||||||
:left left
|
:left left
|
||||||
:options [[(tr "labels.rename") on-edit]
|
:options [[(tr "labels.rename") on-edit]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue