-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Feature/#66 z index properties
- Loading branch information
Showing
17 changed files
with
275 additions
and
53 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
src/common/components/icons/bring-forward-icon.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export const BringForwardIcon = () => { | ||
return ( | ||
<svg | ||
id="icon" | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1.2em" | ||
height="1.2em" | ||
viewBox="0 0 32 32" | ||
> | ||
<path d="M12,15H10V12a2.0023,2.0023,0,0,1,2-2h3v2H12Z" /> | ||
<path d="M15,30H12a2.0023,2.0023,0,0,1-2-2V25h2v3h3Z" /> | ||
<rect x="18" y="28" width="4" height="2" /> | ||
<path d="M28,30H25V28h3V25h2v3A2.0023,2.0023,0,0,1,28,30Z" /> | ||
<rect x="10" y="18" width="2" height="4" /> | ||
<rect x="28" y="18" width="2" height="4" /> | ||
<path d="M30,15H28V12H25V10h3a2.0023,2.0023,0,0,1,2,2Z" /> | ||
<rect x="18" y="10" width="4" height="2" /> | ||
<path d="M8,22H4a2.0023,2.0023,0,0,1-2-2V4A2.0023,2.0023,0,0,1,4,2H20a2.0023,2.0023,0,0,1,2,2V8H20V4H4V20H8Z" /> | ||
<rect | ||
id="_Transparent_Rectangle_" | ||
data-name="<Transparent Rectangle>" | ||
width="1.2em" | ||
height="1.2em" | ||
fill="none" | ||
/> | ||
</svg> | ||
); | ||
}; |
20 changes: 20 additions & 0 deletions
20
src/common/components/icons/bring-to-front-icon.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export const BringToFrontIcon = () => { | ||
return ( | ||
<svg | ||
id="icon" | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1.2em" | ||
height="1.2em" | ||
viewBox="0 0 32 32" | ||
> | ||
<path d="M28,10H22V4a2.0023,2.0023,0,0,0-2-2H4A2.0023,2.0023,0,0,0,2,4V20a2.0023,2.0023,0,0,0,2,2h6v6a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V12A2,2,0,0,0,28,10ZM4,20,3.9985,4H20v6H12a2,2,0,0,0-2,2v8Z" /> | ||
<rect | ||
id="_Transparent_Rectangle_" | ||
data-name="<Transparent Rectangle>" | ||
width="1.2em" | ||
height="1.2em" | ||
fill="none" | ||
/> | ||
</svg> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
export * from './about-icon.component'; | ||
export * from './bring-forward-icon.component'; | ||
export * from './bring-to-front-icon.component'; | ||
export * from './send-backward-icon.component'; | ||
export * from './send-to-back-icon.component'; |
25 changes: 25 additions & 0 deletions
25
src/common/components/icons/send-backward-icon.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export const SendBackwardIcon = () => { | ||
return ( | ||
<svg | ||
id="icon" | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1.2em" | ||
height="1.2em" | ||
viewBox="0 0 32 32" | ||
> | ||
<path d="M4,7H2V4A2.0023,2.0023,0,0,1,4,2H7V4H4Z" /> | ||
<path d="M7,22H4a2.0023,2.0023,0,0,1-2-2V17H4v3H7Z" /> | ||
<rect x="2" y="10" width="2" height="4" /> | ||
<path d="M22,7H20V4H17V2h3a2.0023,2.0023,0,0,1,2,2Z" /> | ||
<rect x="10" y="2" width="4" height="2" /> | ||
<path d="M28,30H12a2.0023,2.0023,0,0,1-2-2V12a2.0023,2.0023,0,0,1,2-2H28a2.0023,2.0023,0,0,1,2,2V28A2.0023,2.0023,0,0,1,28,30ZM12,12V28H28V12Z" /> | ||
<rect | ||
id="_Transparent_Rectangle_" | ||
data-name="<Transparent Rectangle>" | ||
width="1.2em" | ||
height="1.2em" | ||
fill="none" | ||
/> | ||
</svg> | ||
); | ||
}; |
20 changes: 20 additions & 0 deletions
20
src/common/components/icons/send-to-back-icon.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export const SendToBackIcon = () => { | ||
return ( | ||
<svg | ||
id="icon" | ||
xmlns="http://www.w3.org/2000/svg" | ||
width="1.2em" | ||
height="1.2em" | ||
viewBox="0 0 32 32" | ||
> | ||
<path d="M28,10H22V4a2,2,0,0,0-2-2H4A2,2,0,0,0,2,4V20a2,2,0,0,0,2,2h6v6a2.0023,2.0023,0,0,0,2,2H28a2.0023,2.0023,0,0,0,2-2V12A2.0023,2.0023,0,0,0,28,10ZM12,28V12H28l.0015,16Z" /> | ||
<rect | ||
id="_Transparent_Rectangle_" | ||
data-name="<Transparent Rectangle>" | ||
width="1.2em" | ||
height="1.2em" | ||
fill="none" | ||
/> | ||
</svg> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/pods/properties/components/zindex/zindex-button.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import classes from './zindex-option.module.css'; | ||
|
||
interface ButtonProps { | ||
onClick: () => void; | ||
Icon: React.ComponentType; | ||
} | ||
|
||
export const ZIndexButton: React.FC<ButtonProps> = props => { | ||
const { onClick, Icon } = props; | ||
return ( | ||
<button onClick={onClick} className={classes.button}> | ||
<Icon /> | ||
</button> | ||
); | ||
}; |
49 changes: 49 additions & 0 deletions
49
src/pods/properties/components/zindex/zindex-option.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { | ||
SelectionInfo, | ||
ZIndexAction, | ||
} from '@/core/providers/canvas/canvas.model'; | ||
import classes from './zindex-option.module.css'; | ||
import { | ||
BringForwardIcon, | ||
BringToFrontIcon, | ||
SendBackwardIcon, | ||
SendToBackIcon, | ||
} from '@/common/components/icons'; | ||
import { ZIndexButton } from './zindex-button.component'; | ||
|
||
interface LayerOption { | ||
position: ZIndexAction; | ||
Icon: React.ComponentType; | ||
} | ||
|
||
const layersOptions: LayerOption[] = [ | ||
{ position: 'top', Icon: BringToFrontIcon }, | ||
{ position: 'up', Icon: BringForwardIcon }, | ||
{ position: 'down', Icon: SendBackwardIcon }, | ||
{ position: 'bottom', Icon: SendToBackIcon }, | ||
]; | ||
|
||
interface Props { | ||
selectionInfo: SelectionInfo; | ||
} | ||
|
||
export const ZIndexOptions: React.FC<Props> = props => { | ||
const { selectionInfo } = props; | ||
|
||
const handleZIndexChange = (position: ZIndexAction) => { | ||
selectionInfo?.setZIndexOnSelected(position); | ||
}; | ||
|
||
return ( | ||
<div className={classes.container}> | ||
<p>Layering</p> | ||
{layersOptions.map(({ position, Icon }) => ( | ||
<ZIndexButton | ||
key={position} | ||
onClick={() => handleZIndexChange(position)} | ||
Icon={Icon} | ||
/> | ||
))} | ||
</div> | ||
); | ||
}; |
31 changes: 31 additions & 0 deletions
31
src/pods/properties/components/zindex/zindex-option.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
.container { | ||
display: flex; | ||
gap: 0.5em; | ||
align-items: center; | ||
padding: var(--space-xs) var(--space-md); | ||
border-bottom: 1px solid var(--primary-300); | ||
} | ||
|
||
.container :first-child { | ||
flex: 1; | ||
} | ||
|
||
.button { | ||
border: none; | ||
color: var(--text-color); | ||
background-color: inherit; | ||
padding: var(--space-xs); | ||
border-radius: var(--border-radius-s); | ||
font-size: var(--fs-xs); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
gap: var(--space-s); | ||
transition: all 0.3s ease-in-out; | ||
cursor: pointer; | ||
} | ||
|
||
.button:hover { | ||
background-color: var(--primary-100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './properties.pod'; |
Oops, something went wrong.