1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
| <template>
| <div>
| <active-element
| :topic-title="activeTopic && activeTopic.title"
| :text="activeTopic && activeTopic.fullText"
| ></active-element>
| <knowledge-base ></knowledge-base>
| </div>
| </template>
|
| <script>
| export default {
| data() {
| return {
| topics: [
| {
| id: 'basics',
| title: 'The Basics',
| description: 'Core Vue basics you have to know',
| fullText:
| 'Vue is a great framework and it has a couple of key concepts: Data binding, events, components and reactivity - that should tell you something!',
| },
| {
| id: 'components',
| title: 'Components',
| description:
| 'Components are a core concept for building Vue UIs and apps',
| fullText:
| 'With components, you can split logic (and markup) into separate building blocks and then combine those building blocks (and re-use them) to build powerful user interfaces.',
| },
| ],
| activeTopic: null,
| };
| },
| provide(){
| return {
| topics: this.topics,
| selectTopic: this.activateTopic,
| }
| },
| methods: {
| activateTopic(topicId) {
| this.activeTopic = this.topics.find((topic) => topic.id === topicId);
| },
| },
| mounted(){
| setTimeout(() => {
| this.topics.push({
| id: 'events',
| title: 'Events',
| description: 'Vieni all\'evento',
| fullText:
| 'Gli eventi ti permettono di triggherare il codice on demand',
| });
| }, 3000);
| }
| };
| </script>
|
| <style>
| * {
| box-sizing: border-box;
| }
| html {
| font-family: sans-serif;
| }
| body {
| margin: 0;
| }
| section {
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
| margin: 2rem auto;
| max-width: 40rem;
| padding: 1rem;
| border-radius: 12px;
| }
|
| ul {
| list-style: none;
| margin: 0;
| padding: 0;
| display: flex;
| justify-content: center;
| }
|
| li {
| border-radius: 12px;
| border: 1px solid #ccc;
| padding: 1rem;
| width: 15rem;
| margin: 0 1rem;
| display: flex;
| flex-direction: column;
| justify-content: space-between;
| }
|
| h2 {
| margin: 0.75rem 0;
| text-align: center;
| }
|
| button {
| font: inherit;
| border: 1px solid #c70053;
| background-color: #c70053;
| color: white;
| padding: 0.75rem 2rem;
| border-radius: 30px;
| cursor: pointer;
| }
|
| button:hover,
| button:active {
| background-color: #e24d8b;
| border-color: #e24d8b;
| }
| </style>
|
|