Skip to content

Commit 698fd75

Browse files
committed
Started working on project
1 parent dfac2ae commit 698fd75

File tree

5 files changed

+174
-93
lines changed

5 files changed

+174
-93
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Carrene
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

package-lock.json

Lines changed: 7 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,19 @@
11
<template>
22
<div id="app">
3-
<img alt="Vue logo" src="./assets/logo.png">
4-
<HelloWorld msg="Welcome to Your Vue.js App"/>
3+
<loading-checkbox />
54
</div>
65
</template>
76

87
<script>
9-
import HelloWorld from './components/HelloWorld.vue'
8+
import LoadingCheckbox from './components/LoadingCheckbox'
109
1110
export default {
12-
name: 'app',
11+
name: 'App',
1312
components: {
14-
HelloWorld
13+
LoadingCheckbox
1514
}
1615
}
1716
</script>
1817

19-
<style lang="scss">
20-
#app {
21-
font-family: 'Avenir', Helvetica, Arial, sans-serif;
22-
-webkit-font-smoothing: antialiased;
23-
-moz-osx-font-smoothing: grayscale;
24-
text-align: center;
25-
color: #2c3e50;
26-
margin-top: 60px;
27-
}
18+
<style lang="sass">
2819
</style>

src/components/HelloWorld.vue

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/components/LoadingCheckbox.vue

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
<template>
2+
<div id="loadingCheckbox" :style="containerStyles">
3+
<div class="checkbox" :class="status" :style="checkboxStyles">
4+
<div class="loading" v-if="status === 'loading'" :style="loadingStyle"></div>
5+
<div class="check" v-else-if="status === 'checked'" :style="checkStyles"></div>
6+
<div class="unchecked" v-else></div>
7+
</div>
8+
<p class="label" v-if="label" :style="labelStyles">{{ label }}</p>
9+
</div>
10+
</template>
11+
12+
<script>
13+
export default {
14+
name: 'PendingCheckbox',
15+
props: {
16+
status: {
17+
type: String,
18+
default: 'unchecked'
19+
},
20+
label: {
21+
type: String,
22+
default: null
23+
},
24+
size: {
25+
type: Number,
26+
default: 30
27+
},
28+
fontSize: {
29+
type: Number,
30+
default: null
31+
},
32+
gap: {
33+
type: Number,
34+
default: null
35+
}
36+
},
37+
computed: {
38+
checkboxStyles () {
39+
return Object.assign(
40+
{
41+
width: `${this.size}px`,
42+
height: `${this.size}px`,
43+
borderWidth: '1px',
44+
borderColor: 'black',
45+
borderStyle: 'solid',
46+
position: 'relative'
47+
},
48+
this.checkedStyles
49+
)
50+
},
51+
checkedStyles () {
52+
if (this.status === 'checked') {
53+
return {
54+
background: 'red'
55+
}
56+
} else {
57+
return {}
58+
}
59+
},
60+
checkStyles () {
61+
return {
62+
position: 'absolute',
63+
border: 'solid white',
64+
top: '50%',
65+
left: '50%',
66+
transform: 'translate(-60%, -65%) rotate(45deg)',
67+
transformOrigin: '55% 55%',
68+
width: `${this.size * 0.33}px`,
69+
height: `${this.size * 0.66}px`,
70+
borderWidth: `0 ${this.size * 0.1 >= 2 ? this.size * 0.1 : 2}px ${this.size * 0.1 >= 2 ? this.size * 0.1 : 2}px 0`
71+
}
72+
},
73+
loadingStyle () {
74+
return {
75+
border: '6px solid #f3f3f3',
76+
borderRadius: '50%',
77+
borderTop: '16px solid #3498db',
78+
width: '20px',
79+
height: '20px',
80+
animation: 'spin 2s linear infinite'
81+
}
82+
},
83+
containerStyles () {
84+
return Object.assign(
85+
{
86+
display: 'grid',
87+
gridTemplateColumns: 'auto 1fr',
88+
alignItems: 'center',
89+
width: 'fit-content',
90+
cursor: 'pointer'
91+
},
92+
this.computedGap
93+
)
94+
},
95+
labelStyles () {
96+
if (this.fontSize) {
97+
return {
98+
fontSize: `${this.fontSize}px`,
99+
lineHeight: `${this.fontSize}px`
100+
}
101+
} else {
102+
return {
103+
fontSize: `${this.size * 1.1}px`,
104+
lineHeight: `${this.size * 1.1}px`
105+
}
106+
}
107+
},
108+
computedGap () {
109+
if (this.gap) {
110+
return {
111+
gridColumnGap: `${this.gap}px`
112+
}
113+
} else {
114+
return {
115+
gridColumnGap: `${this.size * 0.2}px`
116+
}
117+
}
118+
}
119+
}
120+
}
121+
</script>
122+
123+
<style scoped lang="sass">
124+
*
125+
padding: 0
126+
margin: 0
127+
128+
#loadingCheckbox
129+
@-webkit-keyframes spin
130+
0%
131+
-webkit-transform: rotate(0deg)
132+
100%
133+
-webkit-transform: rotate(360deg)
134+
135+
@keyframes spin
136+
0%
137+
transform: rotate(0deg)
138+
100%
139+
transform: rotate(360deg)
140+
141+
</style>

0 commit comments

Comments
 (0)