@eturnity/eturnity_reusable_components 1.1.15 → 1.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "1.1.15",
3
+ "version": "1.1.18",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vue-cli-service serve",
@@ -0,0 +1,4 @@
1
+ <svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M22 10V12L0 12L1.19209e-07 10L22 10Z" fill="white"/>
3
+ <path d="M10 0H12V22H10V0Z" fill="white"/>
4
+ </svg>
@@ -0,0 +1,58 @@
1
+ <template>
2
+ <page-container :shouldPosition="shouldPosition">
3
+ <button-container>
4
+ <plus-button :src="require('../../assets/icons/plus_button.svg')" />
5
+ </button-container>
6
+ </page-container>
7
+ </template>
8
+
9
+ <script>
10
+ // import AddNewButton from "@eturnity/eturnity_reusable_components/src/components/addNewButton"
11
+ import styled from "vue-styled-components"
12
+
13
+ const pageAttrs = { shouldPosition: Boolean }
14
+ const PageContainer = styled("div", pageAttrs)`
15
+ position: ${(props) => (props.shouldPosition ? "fixed" : "unset")};
16
+ bottom: 60px;
17
+ right: 60px;
18
+ `
19
+
20
+ const ButtonContainer = styled.div`
21
+ height: 60px;
22
+ width: 60px;
23
+ background-color: ${(props) => props.theme.colors.green};
24
+ box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
25
+ border-radius: 100%;
26
+ cursor: pointer;
27
+ display: grid;
28
+ align-items: center;
29
+ justify-items: center;
30
+
31
+ &:hover {
32
+ background: linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
33
+ ${(props) => props.theme.colors.green};
34
+ }
35
+
36
+ &:active,
37
+ &:focus {
38
+ background: ${(props) => props.theme.colors.green};
39
+ }
40
+ `
41
+
42
+ const PlusButton = styled.img``
43
+
44
+ export default {
45
+ name: "add-new-button",
46
+ components: {
47
+ PageContainer,
48
+ ButtonContainer,
49
+ PlusButton,
50
+ },
51
+ props: {
52
+ shouldPosition: {
53
+ required: false,
54
+ default: true,
55
+ },
56
+ },
57
+ }
58
+ </script>
@@ -1,7 +1,11 @@
1
1
  <template>
2
- <wrapper @mouseover="isHovered = true" @mouseleave="isHovered = false">
2
+ <wrapper
3
+ @mouseover="isHovered = true"
4
+ @mouseleave="isHovered = false"
5
+ :isDisabled="isDisabled"
6
+ >
3
7
  <icon-image
4
- v-if="isHovered"
8
+ v-if="isHovered && !isDisabled"
5
9
  :src="require('../../assets/icons/delete_icon.svg')"
6
10
  />
7
11
  <icon-image
@@ -13,13 +17,14 @@
13
17
 
14
18
  <script>
15
19
  // To use:
16
- // <delete-icon />
20
+ // <delete-icon color="gray" @click.native="onDeleteItem(item)" :isDisabled="true" />
17
21
  import styled from "vue-styled-components"
18
22
 
19
- const Wrapper = styled.div`
23
+ const wrapperAttrs = { isDisabled: Boolean }
24
+ const Wrapper = styled("div", wrapperAttrs)`
20
25
  width: 30px;
21
26
  height: 30px;
22
- cursor: pointer;
27
+ cursor: ${(props) => (props.isDisabled ? "not-allowed" : "pointer")};
23
28
  `
24
29
 
25
30
  const IconImage = styled.img`
@@ -35,6 +40,12 @@ export default {
35
40
  Wrapper,
36
41
  IconImage,
37
42
  },
43
+ props: {
44
+ isDisabled: {
45
+ required: false,
46
+ default: false,
47
+ },
48
+ },
38
49
  data() {
39
50
  return {
40
51
  isHovered: false,
@@ -1,11 +1,17 @@
1
1
  <template>
2
2
  <page-container @click="toggleButton()">
3
- <button-container>
3
+ <button-container ref="dropdownItem">
4
4
  <dot-item />
5
5
  <dot-item />
6
6
  <dot-item />
7
7
  </button-container>
8
- <dropdown-container v-if="isOpen" @click.stop>
8
+ <dropdown-container
9
+ v-if="isOpen"
10
+ @click.stop
11
+ :top="getItemLocation('top')"
12
+ :right="getItemLocation('right')"
13
+ :containerWidth="childOpen ? 420 : 220"
14
+ >
9
15
  <loading-container v-if="isLoading">
10
16
  <spinner />
11
17
  </loading-container>
@@ -148,12 +154,13 @@ const DotItem = styled.div`
148
154
  border-radius: 50%;
149
155
  `
150
156
 
151
- const DropdownContainer = styled.div`
157
+ const dropdownAttrs = { top: Number, right: Number, containerWidth: Number }
158
+ const DropdownContainer = styled("div", dropdownAttrs)`
152
159
  z-index: 99;
153
160
  height: 200px;
154
- margin-top: 50px;
161
+ top: ${(props) => props.top + "px"};
162
+ left: ${(props) => props.right - props.containerWidth + "px"};
155
163
  position: absolute;
156
- right: 20px;
157
164
  display: grid;
158
165
  grid-template-columns: auto auto;
159
166
  `
@@ -283,6 +290,14 @@ export default {
283
290
  document.removeEventListener("click", this.clickOutside)
284
291
  }
285
292
  },
293
+ getItemLocation(value) {
294
+ let ref = this.$refs.dropdownItem
295
+ let location = ref.$el.getBoundingClientRect()[value]
296
+ if (value === "top") {
297
+ location = location + window.scrollY
298
+ }
299
+ return location
300
+ },
286
301
  hasChildren(item) {
287
302
  return !!item.children && !!item.children.length
288
303
  },