-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e2c7098
commit 2c27ead
Showing
3 changed files
with
256 additions
and
8 deletions.
There are no files selected for viewing
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,18 +1,20 @@ | ||
## TODO: options needed | ||
|
||
* element (selector on which the spacer is implemented) | type: string | ||
* containedArea (use if you're not able to find the element (ex- iframe)) | type: object | ||
* spacerClass (for adding classes in the spacers) | type: string | ||
* padding (to enable padding, which'll be default behaviour) | type: boolean | ||
* margin (to enable margin) | type: boolean | ||
* defaultSpacing (default margin/padding values) | type: string | ||
* onDragEnd (a function for using the values when drag is ended) | type: function | ref: interactjs | ||
* defaultPadding (an object with top, bottom, left, right values) | type: object | ||
* defaultMargin (an object with top, bottom, left, right values) | type: object | ||
* spacingUnit (to change default spacing unit of spacers like em, rem, in, cm ..etc) | type: string | ||
* showOnHover (to show spacers only on hover) | type: boolean | ||
* appendHtml (to append spacer divs ) | type: string | values: (begin, end) | ref: https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML#visualization_of_position_names | default: afterbegin | ||
* showSpacingValue (to show the margin/padding number in the center of spacer) | type: boolean | ||
* showLabel: (to show the label beside spacing value) | type: string | ||
* showLocks: (to link opposite spacers) | ||
* | ||
|
||
## Done | ||
|
||
* element (selector on which the spacer is implemented) | type: string | ||
* appendHtml (to append spacer divs ) | type: string | values: (begin, end) | ref: https://developer.mozilla.org/en-US/docs/Web/API/Element/insertAdjacentHTML#visualization_of_position_names | default: afterbegin | ||
* padding (to enable padding, which'll be default behaviour) | type: boolean | ||
* margin (to enable margin) | type: boolean |
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,80 @@ | ||
:root { | ||
--spacer-size: 8px; | ||
--padding-bg: plum; | ||
--margin-bg: #463626; | ||
} | ||
/* Spacers Styling */ | ||
.spacer { | ||
position: absolute; | ||
z-index: 2; | ||
} | ||
|
||
.spacer-bottom { | ||
bottom: 0; | ||
} | ||
|
||
.spacer-right { | ||
right: 0; | ||
} | ||
|
||
/* colors */ | ||
.spacer[data-type=padding] { | ||
background: var(--padding-bg); | ||
} | ||
|
||
.spacer[data-type=margin] { | ||
background: var(--margin-bg); | ||
} | ||
|
||
/* Padding */ | ||
.spacer[data-position=top], | ||
.spacer[data-position=bottom] { | ||
cursor: ns-resize; | ||
height: var(--spacer-size); | ||
width: 100%; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
.spacer[data-position=right], | ||
.spacer[data-position=left] { | ||
cursor: ew-resize; | ||
width: var(--spacer-size); | ||
height: 100%; | ||
top: 0; | ||
bottom: 0; | ||
} | ||
|
||
/* Padding Drag Position */ | ||
.spacer[data-type=padding].spacer[data-position=top] { | ||
top: 0; | ||
} | ||
|
||
.spacer[data-type=padding].spacer[data-position=bottom] { | ||
bottom: 0; | ||
} | ||
|
||
.spacer[data-type=padding].spacer[data-position=left] { | ||
left: 0; | ||
} | ||
|
||
.spacer[data-type=padding].spacer[data-position=left] { | ||
right: 0; | ||
} | ||
|
||
/* Margin Drag Position */ | ||
.spacer[data-type=margin].spacer[data-position=top] { | ||
bottom: 100%; | ||
} | ||
|
||
.spacer[data-type=margin].spacer[data-position=bottom] { | ||
top: 100%; | ||
} | ||
|
||
.spacer[data-type=margin].spacer[data-position=left] { | ||
right: 100%; | ||
} | ||
|
||
.spacer[data-type=margin].spacer[data-position=right] { | ||
left: 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