Created
April 2, 2020 17:46
-
-
Save jepser/5341820926dc2ced89f594aa0b95b365 to your computer and use it in GitHub Desktop.
template with styles
This file contains hidden or 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
<template> | |
<div class="wrapper"> | |
<h3 class="title">Add new project</h3> | |
<div class="form-section"> | |
<div class="form-input"> | |
<label for="title">Project title</label> | |
<input class="input-field" name="title" v-model="title" /> | |
</div> | |
<div class="form-input form-input-last"> | |
<label for="image">Image URL</label> | |
<input class="input-field" v-model="image" type="url" name="image" /> | |
</div> | |
</div> | |
<label for="description">Project description</label> | |
<textarea class="input-field" name="description" v-model="description"></textarea> | |
<div class="button-wrapper"> | |
<button class="form-button" @click="handleSubmit">SUBMIT</button> | |
</div> | |
</div> | |
</template> | |
<script> | |
export default { | |
name: "AdminView", | |
data() { | |
return { | |
title: "", | |
image: "", | |
description: "" | |
}; | |
}, | |
methods: { | |
handleSubmit: function() { | |
this.$emit("createProject", { | |
title: this.title, | |
image: this.image, | |
description: this.description | |
}); | |
} | |
} | |
}; | |
</script> | |
<style> | |
.wrapper { | |
margin: 24px; | |
} | |
.title { | |
margin: 16px 0; | |
text-align: center; | |
} | |
.input-field { | |
width: 100%; | |
border: 1px solid #111; | |
padding: 4px; | |
font-size: inherit; | |
} | |
.form-section { | |
/* display: flex; */ | |
justify-content: space-between; | |
margin-bottom: 16px; | |
} | |
.form-label { | |
font-weight: bold; | |
} | |
.form-input { | |
max-width: 45%; | |
float: left; | |
} | |
.form-input-last { | |
float: right; | |
} | |
.button-wrapper { | |
text-align: center; | |
} | |
.form-button { | |
background-color: #ccc; | |
border: 1px solid #111; | |
padding: 8px 16px; | |
border-radius: 4px; | |
font-size: inherit; | |
margin: 16px auto; | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment