mirror of
https://github.com/penpot/penpot.git
synced 2025-06-07 12:31:38 +02:00
🐛 Allow to create component from frame
This commit is contained in:
parent
5f77df1996
commit
baf4dfdecc
2 changed files with 32 additions and 30 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
(ns app.main.ui.components.shape-icon
|
||||
(:require
|
||||
[app.common.types.component :as ctk]
|
||||
[app.common.types.shape.layout :as ctl]
|
||||
[app.main.ui.icons :as i]
|
||||
[rumext.v2 :as mf]))
|
||||
|
@ -13,33 +14,33 @@
|
|||
|
||||
(mf/defc element-icon
|
||||
[{:keys [shape main-instance?] :as props}]
|
||||
(case (:type shape)
|
||||
:frame (cond
|
||||
(and (ctl/layout? shape) (ctl/col? shape))
|
||||
i/layout-columns
|
||||
(if (ctk/instance-root? shape)
|
||||
(if main-instance?
|
||||
i/component
|
||||
i/component-copy)
|
||||
(case (:type shape)
|
||||
:frame (cond
|
||||
(and (ctl/layout? shape) (ctl/col? shape))
|
||||
i/layout-columns
|
||||
|
||||
(and (ctl/layout? shape) (ctl/row? shape))
|
||||
i/layout-rows
|
||||
(and (ctl/layout? shape) (ctl/row? shape))
|
||||
i/layout-rows
|
||||
|
||||
:else
|
||||
i/artboard)
|
||||
:image i/image
|
||||
:line i/line
|
||||
:circle i/circle
|
||||
:path i/curve
|
||||
:rect i/box
|
||||
:text i/text
|
||||
:group (if (some? (:component-id shape))
|
||||
(if main-instance?
|
||||
i/component
|
||||
i/component-copy)
|
||||
(if (:masked-group? shape)
|
||||
:else
|
||||
i/artboard)
|
||||
:image i/image
|
||||
:line i/line
|
||||
:circle i/circle
|
||||
:path i/curve
|
||||
:rect i/box
|
||||
:text i/text
|
||||
:group (if (:masked-group? shape)
|
||||
i/mask
|
||||
i/folder))
|
||||
:bool (case (:bool-type shape)
|
||||
:difference i/bool-difference
|
||||
:exclude i/bool-exclude
|
||||
:intersection i/bool-intersection
|
||||
#_:default i/bool-union)
|
||||
:svg-raw i/file-svg
|
||||
nil))
|
||||
i/folder)
|
||||
:bool (case (:bool-type shape)
|
||||
:difference i/bool-difference
|
||||
:exclude i/bool-exclude
|
||||
:intersection i/bool-intersection
|
||||
#_:default i/bool-union)
|
||||
:svg-raw i/file-svg
|
||||
nil)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue