-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from denOldTimer/chapter-six-five
Chapter six-five
- Loading branch information
Showing
6 changed files
with
250 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"users": [ | ||
{ | ||
"id": 1, | ||
"username": "_mitchellRomney", | ||
"firstName": "Mitchell", | ||
"lastName": "Romney", | ||
"email": "mitchellromnet@theearthissquare.com", | ||
"isAdmin": true, | ||
"twoots": [ | ||
{ "id": 1, "content": "Twotter is Amazing!" }, | ||
{ | ||
"id": 2, | ||
"content": "Don't forget to subscribe to The Earth is Square!" | ||
} | ||
] | ||
}, | ||
{ | ||
"id": 2, | ||
"username": "JColeNC", | ||
"firstName": "J.", | ||
"lastName": "Cole", | ||
"email": null, | ||
"isAdmin": false, | ||
"twoots": null | ||
}, | ||
{ | ||
"id": 3, | ||
"username": "kurtisconner", | ||
"firstName": "kurtis", | ||
"lastName": "conner", | ||
"email": null, | ||
"isAdmin": false, | ||
"twoots": null | ||
}, | ||
{ | ||
"id": 4, | ||
"username": "boburnham", | ||
"firstName": "Bo", | ||
"lastName": "Burham", | ||
"email": null, | ||
"isAdmin": false, | ||
"twoots": null | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<template> | ||
<form | ||
class="create-twoot-panel" | ||
@submit.prevent="createNewTwoot" | ||
:class="{ '--exceeded': newTwootCharacterCount > 180 }" | ||
> | ||
<label for="newTwoot" | ||
><strong>New Twoot: </strong>({{ newTwootCharacterCount }}/180)</label | ||
> | ||
<textarea id="newTwoot" rows="4" v-model="newTwootContent"></textarea> | ||
|
||
<div class="create-twoot-panel__submit"> | ||
<div class="create-twoot-type"> | ||
<label for="newTwootType"><strong>Type: </strong></label> | ||
<select id="newTwootType" v-model="selectedTwootType"> | ||
<option | ||
:value="option.value" | ||
v-for="(option, index) in twootTypes" | ||
:key="index" | ||
> | ||
{{ option.name }} | ||
</option> | ||
</select> | ||
</div> | ||
|
||
<button>Twoot It!</button> | ||
</div> | ||
</form> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: "CreateTwootPanel", | ||
data() { | ||
return { | ||
newTwootContent: "", | ||
selectedTwootType: "instant", //default => instant | ||
twootTypes: [ | ||
{ value: "draft", name: "Draft" }, | ||
{ value: "instant", name: "Instant Twoot" }, | ||
], | ||
}; | ||
}, | ||
computed: { | ||
newTwootCharacterCount() { | ||
return this.newTwootContent.length; | ||
}, | ||
}, | ||
methods: { | ||
createNewTwoot() { | ||
if (this.newTwootContent && this.selectedTwootType !== "draft") { | ||
this.$emit("add-twoot", this.newTwootContent); | ||
this.newTwootContent = ""; | ||
} | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="scss"> | ||
.create-twoot-panel { | ||
margin-top: 20px; | ||
padding: 20px 0; | ||
display: flex; | ||
flex-direction: column; | ||
textarea { | ||
border: 1px solid #dfe3e8; | ||
border-radius: 5px; | ||
} | ||
.create-twoot-panel__submit { | ||
display: flex; | ||
justify-content: space-between; | ||
.create-twoot-type { | ||
padding: 10px 0; | ||
} | ||
button { | ||
padding: 5px 20px; | ||
margin: auto 0; | ||
border-radius: 5px; | ||
border: none; | ||
background-color: deeppink; | ||
color: white; | ||
font-weight: bold; | ||
} | ||
} | ||
&.--exceeded { | ||
color: red; | ||
border-color: red; | ||
.create-twoot-panel__submit { | ||
button { | ||
background-color: red; | ||
border: none; | ||
color: white; | ||
} | ||
} | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.