First commit :)

This commit is contained in:
RemiSaurel
2022-06-05 01:02:07 +02:00
parent 8c22caa124
commit 04417476b3
4 changed files with 171 additions and 69 deletions
+59 -11
View File
@@ -1,28 +1,76 @@
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
<header>
<Welcome/>
<h3 id="time"></h3>
</header>
<to-do-list></to-do-list>
<div class="ytb">
<iframe width="80%" height="400" src="https://www.youtube.com/embed/MCkTebktHVc?autoplay=1&mute=1" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture">
</iframe>
</div>
</div>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
import Welcome from './components/Welcome.vue'
import ToDoList from "@/components/ToDoList";
export default {
name: 'App',
components: {
HelloWorld
Welcome,
ToDoList
}
}
window.addEventListener("load", () => {
clock();
function clock() {
const today = new Date();
// get time components
const hours = today.getHours();
const minutes = today.getMinutes();
const seconds = today.getSeconds();
//add '0' to hour, minute & second when they are less 10
const hour = hours < 10 ? "0" + hours : hours;
const minute = minutes < 10 ? "0" + minutes : minutes;
const second = seconds < 10 ? "0" + seconds : seconds;
const time = hour + ":" + minute + ":" + second;
document.getElementById("time").innerHTML = time;
setTimeout(clock, 1000);
}
});
</script>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300&display=swap');
* {
background-color: #FFF5DE;
font-family: 'Outfit', sans-serif;
}
.ytb {
text-align: center;
color: #2c3e50;
margin-top: 60px;
margin-top: 16px;
}
header {
display: flex;
flex-direction: row;
justify-content: space-between;
margin-right: 10vw;
margin-left: 10vw;
align-items: center;
}
#time {
font-size: 20px;
}
</style>
-58
View File
@@ -1,58 +0,0 @@
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
+93
View File
@@ -0,0 +1,93 @@
<template>
<div id="todolist">
<input @keydown.enter="addItem(item)" type="text" name="todo" id="todo_input" v-model="item"
placeholder="Insérer votre todo">
<div id="liste">
<div v-for="item in items" :key="item.id" class="item">
<div id="text">
{{item}}
</div>
<div @click="removeItem(item)" id="trash">
🗑
</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "ToDoList",
components: {},
data() {
return {
item: "",
items: []
}
},
methods: {
addItem(item) {
if (item.trim() !== "") {
this.items.push(item)
this.item = ""
}
},
removeItem(item) {
this.items = this.items.filter(e => e !== item)
this.item = ""
}
}
}
</script>
<style scoped>
#todolist {
text-align: center;
}
#todo_input {
font-size: 1.2rem;
width: 50%;
max-width: 400px;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
border-radius: 16px;
border: 2px solid saddlebrown;
}
#todo_input:focus {
outline: none !important;
border: 2px solid #8783D1;
}
#liste {
display: flex;
flex-direction: column;
}
.item {
display: flex;
font-size: 18px;
margin-top: 8px;
align-items: center;
padding: 8px 10px 8px 10px;
border-radius: 12px;
max-width: 50vw;
box-shadow: rgba(111, 111, 111, 0.2) 0px 7px 29px 0px;
margin-left: auto;
margin-right: auto;
word-break: break-all;
}
.item:hover {
box-shadow: #ff0000 0px 1px 6px 0px;
}
#trash {
font-size: 20px;
padding: 8px;
cursor: pointer;
}
</style>
+19
View File
@@ -0,0 +1,19 @@
<template>
<div class="hello">
<h1>ToDoList</h1>
</div>
</template>
<script>
export default {
name: 'Welcome',
props: {
}
}
</script>
<style scoped>
.hello {
text-align: center;
}
</style>