@eturnity/eturnity_reusable_components 1.1.99 → 1.2.0
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
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// <close-button
|
|
14
14
|
// color="#fff"
|
|
15
15
|
// />
|
|
16
|
-
import styled from
|
|
16
|
+
import styled from 'vue-styled-components'
|
|
17
17
|
|
|
18
18
|
const Container = styled.div`
|
|
19
19
|
position: relative;
|
|
@@ -27,8 +27,8 @@ const Wrapper = styled.div`
|
|
|
27
27
|
`
|
|
28
28
|
|
|
29
29
|
const lineAttrs = { color: String }
|
|
30
|
-
const Line = styled(
|
|
31
|
-
width:
|
|
30
|
+
const Line = styled('div', lineAttrs)`
|
|
31
|
+
width: 20px;
|
|
32
32
|
height: 2px;
|
|
33
33
|
background-color: ${(props) =>
|
|
34
34
|
props.color ? props.color : props.theme.colors.red};
|
|
@@ -45,17 +45,17 @@ const RightLine = styled(Line)`
|
|
|
45
45
|
`
|
|
46
46
|
|
|
47
47
|
export default {
|
|
48
|
-
name:
|
|
48
|
+
name: 'close-button',
|
|
49
49
|
components: {
|
|
50
50
|
Container,
|
|
51
51
|
Wrapper,
|
|
52
52
|
LeftLine,
|
|
53
|
-
RightLine
|
|
53
|
+
RightLine
|
|
54
54
|
},
|
|
55
55
|
props: {
|
|
56
56
|
color: {
|
|
57
|
-
required: false
|
|
58
|
-
}
|
|
59
|
-
}
|
|
57
|
+
required: false
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
60
|
}
|
|
61
61
|
</script>
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
// <div>Data....</div>
|
|
25
25
|
// </modal>
|
|
26
26
|
|
|
27
|
-
import styled from
|
|
28
|
-
import CloseButton from
|
|
29
|
-
import Spinner from
|
|
27
|
+
import styled from 'vue-styled-components'
|
|
28
|
+
import CloseButton from '../../buttons/closeButton'
|
|
29
|
+
import Spinner from '../../spinner'
|
|
30
30
|
|
|
31
31
|
const pageAttrs = { isOpen: Boolean }
|
|
32
|
-
const PageWrapper = styled(
|
|
32
|
+
const PageWrapper = styled('div', pageAttrs)`
|
|
33
33
|
position: fixed;
|
|
34
34
|
display: grid;
|
|
35
35
|
top: 0;
|
|
@@ -73,8 +73,8 @@ const ModalContainer = styled.div`
|
|
|
73
73
|
|
|
74
74
|
.close {
|
|
75
75
|
position: absolute;
|
|
76
|
-
right:
|
|
77
|
-
top:
|
|
76
|
+
right: 20px;
|
|
77
|
+
top: 20px;
|
|
78
78
|
|
|
79
79
|
@media (max-width: 425px) {
|
|
80
80
|
right: 14px;
|
|
@@ -93,46 +93,46 @@ const ModalContainer = styled.div`
|
|
|
93
93
|
`
|
|
94
94
|
|
|
95
95
|
export default {
|
|
96
|
-
name:
|
|
96
|
+
name: 'modal',
|
|
97
97
|
components: {
|
|
98
98
|
PageWrapper,
|
|
99
99
|
ModalContainer,
|
|
100
100
|
CloseButton,
|
|
101
|
-
Spinner
|
|
101
|
+
Spinner
|
|
102
102
|
},
|
|
103
103
|
props: {
|
|
104
104
|
isOpen: {
|
|
105
105
|
required: true,
|
|
106
|
-
default: false
|
|
106
|
+
default: false
|
|
107
107
|
},
|
|
108
108
|
preventOutsideClose: {
|
|
109
109
|
required: false,
|
|
110
|
-
default: false
|
|
110
|
+
default: false
|
|
111
111
|
},
|
|
112
112
|
isLoading: {
|
|
113
113
|
required: false,
|
|
114
|
-
default: false
|
|
114
|
+
default: false
|
|
115
115
|
},
|
|
116
116
|
hideClose: {
|
|
117
117
|
required: false,
|
|
118
|
-
default: false
|
|
119
|
-
}
|
|
118
|
+
default: false
|
|
119
|
+
}
|
|
120
120
|
},
|
|
121
121
|
methods: {
|
|
122
122
|
onCloseModal() {
|
|
123
|
-
this.$emit(
|
|
123
|
+
this.$emit('on-close')
|
|
124
124
|
},
|
|
125
125
|
onOutsideClose() {
|
|
126
126
|
// If true, then only allow closing to come from clicking the X or wherever the onCloseModal is called
|
|
127
127
|
if (!this.preventOutsideClose) {
|
|
128
|
-
this.$emit(
|
|
128
|
+
this.$emit('on-close')
|
|
129
129
|
}
|
|
130
|
-
}
|
|
130
|
+
}
|
|
131
131
|
},
|
|
132
132
|
watch: {
|
|
133
133
|
isOpen: function (newVal) {
|
|
134
|
-
document.body.style.overflow = newVal ?
|
|
135
|
-
}
|
|
136
|
-
}
|
|
134
|
+
document.body.style.overflow = newVal ? 'hidden' : ''
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
137
|
}
|
|
138
138
|
</script>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Modal from "./index.vue";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Modal",
|
|
5
|
+
component: Modal,
|
|
6
|
+
// argTypes: {},
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const Template = (args, { argTypes }) => ({
|
|
10
|
+
// Components used in your story `template` are defined in the `components` object
|
|
11
|
+
components: { Modal },
|
|
12
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
13
|
+
props: Object.keys(argTypes),
|
|
14
|
+
template: '<modal v-bind="$props" />',
|
|
15
|
+
|
|
16
|
+
// import Modal from "@eturnity/eturnity_reusable_components/src/components/modals/modal"
|
|
17
|
+
// This is a more flexible modal box, where the parent can decide how the body of the modal looks
|
|
18
|
+
// To use:
|
|
19
|
+
// <modal :isOpen="isOpen" @on-close="$emit('on-close-summary')" :preventOutsideClose="true" :isLoading="true" :hideClose="true">
|
|
20
|
+
// <div>Data....</div>
|
|
21
|
+
// </modal>
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const Default = Template.bind({
|
|
25
|
+
isOpen: true,
|
|
26
|
+
preventOutsideClose: true,
|
|
27
|
+
isLoading: false,
|
|
28
|
+
hideClose: false,
|
|
29
|
+
});
|
|
30
|
+
Default.args = {};
|