From 056d386d0c54212753eb8b3e29d13fb4e1bf6722 Mon Sep 17 00:00:00 2001 From: dohodin Date: Thu, 9 Mar 2023 15:35:25 +0100 Subject: [PATCH] =?UTF-8?q?Question=202,4,5,6=20finies,=20question=203=20?= =?UTF-8?q?=C3=A0=20revoir?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/style.css | 27 ++++++++------------------- index.html | 27 ++++++++++++++++++--------- src/view/link_service.js | 2 +- src/view/navbar.js | 32 ++++++++++++++++++++++++++------ src/view/team_add.js | 18 +++++++++++++++--- src/view/teamcard.js | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 100 insertions(+), 38 deletions(-) create mode 100644 src/view/teamcard.js diff --git a/css/style.css b/css/style.css index 1216f00..5ae2da6 100644 --- a/css/style.css +++ b/css/style.css @@ -1,3 +1,10 @@ +/* Global */ + +.pointer { + cursor: pointer; +} + + /* Onglet */ .menu-pannel { @@ -20,24 +27,6 @@ display: none; } -.team{ - position: absolute; - border: 0; - height: 1px; - width: 1px; - padding: 0; - overflow: hidden; - clip: rect(1px 1px 1px 1px); /* IE6 & IE7 */ - clip: rect(1px, 1px, 1px, 1px); -} - -.team:target{ - position: relative; - height: auto; - padding: initial; - clip: initial; -} - /* Formulaire */ @@ -50,7 +39,7 @@ form input { /* CARD */ .team-card { - border: #000000 1px; + border: #000000 1px solid; border-radius: 5px; } diff --git a/index.html b/index.html index dafb2bc..167132b 100644 --- a/index.html +++ b/index.html @@ -12,9 +12,14 @@
- @@ -23,21 +28,25 @@ import { createApp } from 'https://unpkg.com/vue@3/dist/vue.esm-browser.js'; import Navbar from '/src/view/navbar.js'; - import TeamCard from '/src/view/team_add.js'; + import TeamAdd from '/src/view/team_add.js'; + import Teamcard from '/src/view/teamcard.js'; const app = createApp({ data() { return { - links: [ - '#', - './src/viewhtml/team.html', - 'https://www.github.com', - ] + allTeam: [] + } + }, + methods:{ + addTeam: function(team){ + console.log('index.addTeam',team); + this.allTeam.push(team); } } }) app.component('Navbar', Navbar) - .component('TeamCard', TeamCard); + .component('TeamAdd', TeamAdd) + .component('Teamcard',Teamcard); app.mount('#app'); diff --git a/src/view/link_service.js b/src/view/link_service.js index a04f79d..bfedb0e 100644 --- a/src/view/link_service.js +++ b/src/view/link_service.js @@ -3,7 +3,7 @@ export default class LinkService{ getLinks(){ return [ '#', - './src/viewhtml/team.html', + '#', 'https://www.github.com', ]; } diff --git a/src/view/navbar.js b/src/view/navbar.js index 1f49aee..8f9f476 100644 --- a/src/view/navbar.js +++ b/src/view/navbar.js @@ -1,14 +1,34 @@ export default { props: { - linkHome: String, - linkTeam: String, - linkResults: String + linkHome: { + type: String, + default: '#' + }, + linkTeam:{ + type: String, + default: '' + }, + linkResults: { + type: String, + default: 'https://www.github.com' + } + }, + methods:{ + toggleDiv: function(){ + let div = document.getElementById("team"); + if (div.classList.contains("hide")) { + div.classList.remove("hide"); + } else { + div.classList.add("hide"); + } + } }, template:` ` + }; \ No newline at end of file diff --git a/src/view/team_add.js b/src/view/team_add.js index 33537fe..23e142b 100644 --- a/src/view/team_add.js +++ b/src/view/team_add.js @@ -3,6 +3,7 @@ export default { return { id: '', name: '', + description: '', errorMessage: '', errorColor: ERROR_COLOR } @@ -10,18 +11,25 @@ export default { methods: { addTeam: function() { this.errorMessage = ''; - if (!this.id || !this.name) { - this.errorMessage = 'ID and Name are required !'; + if (!this.id ){ + this.errorMessage = 'ID is required !'; + return; + }else if (!this.name){ + this.errorMessage = 'Name is required !'; + return + }else if(!this.description) { + this.errorMessage = 'Description is required !'; return; } - const team = { id: this.id, name: this.name}; + const team = { id: this.id, name: this.name, description: this.description}; console.log('form.addTeam', team); this.$emit('addTeam', team); this.id = ''; this.name = ''; + this.description = ''; } }, template: `
@@ -36,6 +44,10 @@ export default {
+
+
+ +
` diff --git a/src/view/teamcard.js b/src/view/teamcard.js new file mode 100644 index 0000000..28400e9 --- /dev/null +++ b/src/view/teamcard.js @@ -0,0 +1,32 @@ +export default { + props: { + id: { + type :String, + require : true + }, + name: { + type :String, + require : true + }, + description: { + type :String, + require : true + } + }, + computed: { + description20(){ + if (this.description.length > 20) { + return this.description.substring(0, 20) + '...'; + } else { + return this.description; + } + } + }, + template: ` +
+ ID of the Team : {{ id }} +

Name : {{ name }}

+

Description : {{ description20 }}

+
+ ` +} \ No newline at end of file