Skip to content

Instantly share code, notes, and snippets.

@jepser
Created April 2, 2020 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jepser/5341820926dc2ced89f594aa0b95b365 to your computer and use it in GitHub Desktop.
Save jepser/5341820926dc2ced89f594aa0b95b365 to your computer and use it in GitHub Desktop.
template with styles
<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