Skip to content

Commit 7910220

Browse files
create showcase component
1 parent 4014204 commit 7910220

File tree

2 files changed

+112
-4
lines changed

2 files changed

+112
-4
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<script>
2+
import * as Components from '../../../src/core/components';
3+
4+
const colors = [
5+
{
6+
primary: '#bdc3c7',
7+
secondary: '#95a5a6',
8+
},
9+
{
10+
primary: '#3498db',
11+
secondary: '#2980b9',
12+
},
13+
{
14+
primary: '#1abc9c',
15+
secondary: '#16a085',
16+
},
17+
{
18+
primary: '#f1c40f',
19+
secondary: '#f39c12',
20+
},
21+
{
22+
primary: '#e67e22',
23+
secondary: '#d35400',
24+
},
25+
{
26+
primary: '#e74c3c',
27+
secondary: '#c0392b',
28+
},
29+
{
30+
primary: '#9b59b6',
31+
secondary: '#8e44ad',
32+
},
33+
];
34+
35+
export default {
36+
data: () => ({
37+
background: colors[0],
38+
}),
39+
40+
props: {
41+
type: {
42+
type: String,
43+
required: false,
44+
default: 'VclFacebook',
45+
},
46+
47+
rtl: {
48+
type: Boolean,
49+
required: false,
50+
default: false,
51+
},
52+
},
53+
54+
computed: {
55+
colors () {
56+
return colors;
57+
},
58+
59+
loader () {
60+
return {
61+
rtl: this.rtl,
62+
is: Components[this.type],
63+
64+
...this.background,
65+
};
66+
},
67+
},
68+
69+
methods: {
70+
change (color) {
71+
this.background = color;
72+
},
73+
},
74+
};
75+
</script>
76+
77+
<template>
78+
<div>
79+
<Component v-bind="loader" />
80+
81+
<button
82+
:key="index"
83+
@click.prevent="change(color)"
84+
v-for="(color, index) in colors"
85+
:style="{ backgroundColor: color.primary }"
86+
>
87+
</button>
88+
</div>
89+
</template>
90+
91+
<style scoped>
92+
div {
93+
max-width: 350px;
94+
}
95+
96+
button {
97+
width: 15px;
98+
height: 15px;
99+
border: none;
100+
cursor: pointer;
101+
margin-top: 16px;
102+
margin-right: 8px;
103+
border-radius: 50%;
104+
box-shadow: 1px 2px 5px #767676;
105+
}
106+
</style>

docs/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ footer: MIT Licensed | Copyright © 2017-present Lucas Leandro
1111
1212
## So how does it look like?
1313

14-
Facebook
14+
<Showcase />
1515

16-
![Facebook loading](https://raw.githubusercontent.com/LucasLeandro1204/vue-content-loading/master/static/facebook.gif "Facebook loading")
16+
RTL
1717

18-
Code
18+
<Showcase rtl />
1919

20-
![Code loading](https://raw.githubusercontent.com/LucasLeandro1204/vue-content-loading/master/static/code.gif "Code loading")
20+
## License
21+
22+
This project is licensed under the MIT license. See the [LICENSE file](https://github.com/LucasLeandro1204/vue-content-loading/blob/master/LICENSE) for more details.
2123

2224
## Installation
2325

0 commit comments

Comments
 (0)