0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

Moving select image lightbox to workspace

This commit is contained in:
Jesús Espino 2016-05-20 22:37:26 +02:00
parent a6d15e11ef
commit 0550e73034
4 changed files with 61 additions and 29 deletions

View file

@ -333,31 +333,3 @@
:transfer-state images-page-transfer-state
:name "images-page"
:mixins [mx/static]}))
;; --- New Element Lightbox (TODO)
(defn- new-image-lightbox-render
[own]
(html
[:div.lightbox-body
[:h3 "New image"]
[:div.row-flex
[:div.lightbox-big-btn
[:span.big-svg i/shapes]
[:span.text "Go to workspace"]]
[:div.lightbox-big-btn
[:span.big-svg.upload i/exit]
[:span.text "Upload file"]]]
[:a.close {:href "#"
:on-click #(do (dom/prevent-default %)
(udl/close!))}
i/close]]))
(def ^:private new-image-lightbox
(mx/component
{:render new-image-lightbox-render
:name "new-image-lightbox"}))
(defmethod lbx/render-lightbox :new-image
[_]
(new-image-lightbox))

View file

@ -20,6 +20,7 @@
[uxbox.ui.mixins :as mx]
[uxbox.ui.messages :as uum]
[uxbox.ui.confirm]
[uxbox.ui.workspace.images]
[uxbox.ui.keyboard :as kbd]
[uxbox.ui.workspace.scroll :as scroll]
[uxbox.ui.workspace.download]

View file

@ -75,6 +75,7 @@
toggle #(rs/emit! (dw/toggle-flag %))
on-undo #(rs/emit! (udh/backwards-to-previous-version))
on-redo #(rs/emit! (udh/forward-to-next-version))
on-image #(udl/open! :new-image)
;; TODO: temporary
open-confirm-dialog #(udl/open! :confirm)]
(html
@ -136,7 +137,7 @@
i/export]
[:li.tooltip.tooltip-bottom
{:alt "Image (Ctrl + I)"
:on-click open-confirm-dialog}
:on-click on-image}
i/image]]
[:ul.options-btn
[:li.tooltip.tooltip-bottom

View file

@ -0,0 +1,58 @@
;; This Source Code Form is subject to the terms of the Mozilla Public
;; License, v. 2.0. If a copy of the MPL was not distributed with this
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
;;
;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
(ns uxbox.ui.workspace.images
(:require [sablono.core :as html :refer-macros [html]]
[rum.core :as rum]
[lentes.core :as l]
[uxbox.locales :as t :refer (tr)]
[uxbox.state :as st]
[uxbox.rstore :as rs]
[uxbox.library :as library]
[uxbox.data.dashboard :as dd]
[uxbox.data.lightbox :as udl]
[uxbox.data.images :as di]
[uxbox.ui.icons :as i]
[uxbox.ui.mixins :as mx]
[uxbox.ui.lightbox :as lbx]
[uxbox.ui.keyboard :as k]
[uxbox.ui.library-bar :as ui.library-bar]
[uxbox.ui.dashboard.header :refer (header)]
[uxbox.util.lens :as ul]
[uxbox.util.dom :as dom]))
;; --- Helpers & Constants
(defn- new-image-lightbox-render
[own]
(html
[:div.lightbox-body
[:h3 "New image"]
[:div.row-flex
[:div.lightbox-big-btn
[:span.big-svg i/shapes]
[:span.text "Go to workspace"]]
[:div.lightbox-big-btn
{:on-click #(dom/click (dom/get-element-by-class "upload-image-input"))}
[:span.big-svg.upload i/exit]
[:span.text "Upload file"]
[:input.upload-image-input {:style {:display "none"}
:type "file"
:on-change #(rs/emit! (di/create-images nil (dom/get-event-files %)))}]]]
[:a.close {:href "#"
:on-click #(do (dom/prevent-default %)
(udl/close!))}
i/close]]))
(def ^:private new-image-lightbox
(mx/component
{:render new-image-lightbox-render
:name "new-image-lightbox"}))
(defmethod lbx/render-lightbox :new-image
[_]
(new-image-lightbox))