💄 Add new project header

This commit is contained in:
elhombretecla 2021-06-15 09:55:38 +02:00 committed by Alonso Torres
parent 5cddc9836f
commit a106c728ba
6 changed files with 48 additions and 23 deletions

View file

@ -8,6 +8,7 @@
- Allow to ungroup assets [Taiga #1719](https://tree.taiga.io/project/penpot/us/1719) - Allow to ungroup assets [Taiga #1719](https://tree.taiga.io/project/penpot/us/1719)
- Allow to rename assets groups [Taiga #1721](https://tree.taiga.io/project/penpot/us/1721) - Allow to rename assets groups [Taiga #1721](https://tree.taiga.io/project/penpot/us/1721)
- Memorize collapse state of assets in panel [Taiga #1718](https://tree.taiga.io/project/penpot/us/1718) - Memorize collapse state of assets in panel [Taiga #1718](https://tree.taiga.io/project/penpot/us/1718)
- Headers button sets and menus review [Taiga #1663](https://tree.taiga.io/project/penpot/us/1663)
- Add the ability to offload file data to a cheaper storage when file - Add the ability to offload file data to a cheaper storage when file
becomes inactive. becomes inactive.

View file

@ -104,7 +104,12 @@
} }
} }
.dashboard-header-actions {
display: flex;
}
.pin-icon { .pin-icon {
margin: 0 $small 0 $big;
svg { svg {
fill: $color-gray-20; fill: $color-gray-20;
} }

View file

@ -34,7 +34,7 @@
height: 40px; height: 40px;
.btn-secondary { .btn-secondary {
margin-left: $big; border: none;
height: 32px; height: 32px;
} }
@ -62,6 +62,7 @@
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: 40px;
margin-right: 10px; margin-right: 10px;
svg { svg {
width: 15px; width: 15px;

View file

@ -29,7 +29,11 @@
team-id (:id team) team-id (:id team)
on-menu-click on-menu-click
(mf/use-callback #(swap! local assoc :menu-open true)) (mf/use-callback
(fn [event]
(let [position (dom/get-client-position event)]
(dom/prevent-default event)
(swap! local assoc :menu-open true :menu-pos position))))
on-menu-close on-menu-close
(mf/use-callback #(swap! local assoc :menu-open false)) (mf/use-callback #(swap! local assoc :menu-open false))
@ -63,20 +67,26 @@
[:div.dashboard-title [:div.dashboard-title
[:h1 {:on-double-click on-edit} [:h1 {:on-double-click on-edit}
(:name project)] (:name project)]
[:div.icon {:on-click on-menu-click}
i/actions]
[:& project-menu {:project project [:& project-menu {:project project
:show? (:menu-open @local) :show? (:menu-open @local)
:left (- (:x (:menu-pos @local)) 180)
:top (:y (:menu-pos @local))
:on-edit on-edit :on-edit on-edit
:on-menu-close on-menu-close}] :on-menu-close on-menu-close}]]))
[:div.icon.pin-icon [:div.dashboard-header-actions
[:a.btn-secondary.btn-small {:on-click on-create-clicked}
(tr "dashboard.new-file")]
[:div.icon.pin-icon.tooltip.tooltip-bottom
{:class (when (:is-pinned project) "active") {:class (when (:is-pinned project) "active")
:on-click toggle-pin} :on-click toggle-pin :alt (tr "dashboard.pin-unpin")}
(if (:is-pinned project) (if (:is-pinned project)
i/pin-fill i/pin-fill
i/pin)]])) i/pin)]
[:a.btn-secondary.btn-small {:on-click on-create-clicked}
(tr "dashboard.new-file")]])) [:div.icon.tooltip.tooltip-bottom
{:on-click on-menu-click :alt (tr "dashboard.options")}
i/actions]]]))
(mf/defc files-section (mf/defc files-section
[{:keys [project team] :as props}] [{:keys [project team] :as props}]

View file

@ -108,13 +108,6 @@
[:div.dashboard-project-row {:class (when first? "first")} [:div.dashboard-project-row {:class (when first? "first")}
[:div.project [:div.project
(when-not (:is-default project)
[:span.pin-icon
{:class (when (:is-pinned project) "active")
:on-click toggle-pin}
(if (:is-pinned project)
i/pin-fill
i/pin)])
(if (:edition? @local) (if (:edition? @local)
[:& inline-edition {:content (:name project) [:& inline-edition {:content (:name project)
:on-end on-edit}] :on-end on-edit}]
@ -141,9 +134,21 @@
#_[:& import-button {:project-id (:id project) #_[:& import-button {:project-id (:id project)
:on-finish-import on-finish-import}] :on-finish-import on-finish-import}]
[:a.btn-secondary.btn-small (when-not (:is-default project)
{:on-click create-file} [:span.pin-icon.tooltip.tooltip-bottom
(tr "dashboard.new-file")]] {:class (when (:is-pinned project) "active")
:on-click toggle-pin :alt (tr "dashboard.pin-unpin")}
(if (:is-pinned project)
i/pin-fill
i/pin)])
[:a.btn-secondary.btn-small.tooltip.tooltip-bottom
{:on-click create-file :alt (tr "dashboard.new-file")}
i/close]
[:a.btn-secondary.btn-small.tooltip.tooltip-bottom
{:on-click on-menu-click :alt (tr "dashboard.options")}
i/actions]]
[:& line-grid [:& line-grid
{:project-id (:id project) {:project-id (:id project)

View file

@ -2693,3 +2693,6 @@ msgstr "Export file"
msgid "dashboard.export-multi" msgid "dashboard.export-multi"
msgstr "Export %s files" msgstr "Export %s files"
msgid "dashboard.options"
msgstr "Options"