Skip to content

Commit

Permalink
refactor frame to one thing
Browse files Browse the repository at this point in the history
  • Loading branch information
crcn committed Jan 14, 2024
1 parent fe44123 commit c82a00c
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 73 deletions.
3 changes: 3 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Start consolidating components + cleaning them up
- ability to detach instances
- detach lightning icon
7 changes: 0 additions & 7 deletions libs/designer/src/ui/logic/Editor/Canvas/Frames/styles.pc

This file was deleted.

100 changes: 36 additions & 64 deletions libs/designer/src/ui/logic/Editor/Canvas/Tools/Frames/index.pc
Original file line number Diff line number Diff line change
@@ -1,86 +1,55 @@
import "ui/theme.pc" as module


/**
* @frame(x: 2887, y: 300, width: 301, height: 304)
*/
public component LightningIcon {
render div {
style extends module.icon {
mask-image: url("ui/lightning.svg")
width: 1.2em
height: 1.2em
}
}
}

/**
* @frame(width: 1024, height: 768, x: 1457, y: -176)
*/
public component FramesContainer {
render div(style: style, data-label: "Frames container", class: class) {
style {
width: 100%
height: 100%
position: relative
}
slot children
}
}

/**
* @frame(width: 1024, height: 768, x: 668, y: 1081)
*/
public component Frame {
variant hasScript trigger {
".hasScript"
}
render div(style: style, class: class) {
style {
position: relative
}
slot children
}
}

/**
* @frame(width: 1024, height: 768, x: 91, y: -1397)
*/
public component FrameTitle {
variant hasScript trigger {
".hasScript"
".has-script"
}
render div(onDoubleClick: onDoubleClick, style: style, onClick: onClick, onMouseUp: onMouseUp, class: class) {
span title {
div titleOuter {
style {
cursor: default
white-space: nowrap
overflow: hidden
font-size: 12px
text-overflow: ellipsis
transform: translateY(calc(-100% - 6px))
position: absolute
user-select: none
top: 0px
left: 0px
color: white
opacity: 0.5
width: 100%
display: flex
gap: var(module.space02)
justify-content: space-between
}
LightningIcon {
style variant hasScript {
display: block
span titleContainer {
div {
style variant hasScript {
display: block
}
style extends module.icon {
width: 1em
height: 1em
mask-image: url("ui/lightning.svg")
display: none
}
}
style {
display: none
cursor: default
white-space: nowrap
overflow: hidden
font-size: 12px
text-overflow: ellipsis
display: flex
gap: var(module.space02)
}
slot title
}
slot value
}
style {
transform: translateY(calc(-100% - 6px))
position: absolute
user-select: none
top: 0px
left: 0px
color: white
opacity: 0.5
width: 100%
display: flex
justify-content: space-between
}
slot children
}
}

Expand All @@ -103,6 +72,9 @@ div preview {
text "some title"
}
}
insert title {
text "double click to edit"
}
}
}

10 changes: 8 additions & 2 deletions libs/designer/src/ui/logic/Editor/Canvas/Tools/Frames/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const Frame = memo(

return (
<styles.Frame
class={cx({ hasScript })}
style={{
left: 0,
top: 0,
Expand All @@ -151,16 +152,21 @@ const Frame = memo(
transformOrigin: "top left",
position: "absolute",
}}
titleOuter={{
onDoubleClick: onDoubleClick,
onMouseUp: onClick,
}}
title={title}
>
<styles.FrameTitle
{/* <styles.FrameTitle
class={cx({ hasScript })}
// onBlur={onBlur}
// onKeyPress={onKeyPress}
onDoubleClick={onDoubleClick}
// inputRef={inputRef}
onMouseUp={onClick}
value={title}
/>
/> */}
</styles.Frame>
);
}
Expand Down

0 comments on commit c82a00c

Please sign in to comment.