Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add create graph form #12

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/pixela-colors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class Color {
constructor(public readonly name: string,
public readonly colorName: string,
public readonly colorCodes: string[]) {
}
}

const colors = {
shibafu: new Color('shibafu', 'green', []),
momiji: new Color('momiji', 'red', []),
sora: new Color('sora', 'blue', []),
ichou: new Color('ichou', 'yellow', []),
ajisai: new Color('ajisai', 'purple', []),
kuro: new Color('kuro', 'black', []),
};

export {colors};
5 changes: 5 additions & 0 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export default new Router({
name: 'graph',
component: () => import('./views/GraphList.vue'),
},
{
path: '/graphs/new',
name: 'createGraph',
component: () => import('./views/CreateGraph.vue'),
},
{
path: '/diary',
name: 'diary',
Expand Down
92 changes: 92 additions & 0 deletions src/views/CreateGraph.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<template>
<form novalidate class="md-layout md-gutter md-alignment-center">
<md-card class="md-layout-item md-size-90">
<md-card-header>
<div class="md-title">New Graph</div>
</md-card-header>

<md-card-content>
<div class="md-layout md-gutter">
<div class="md-layout-item md-size-50 md-small-size-100">
<md-field>
<label for="graph-id">ID</label>
<md-input name="graph-id" id="graph-id"/>
</md-field>
</div>

<div class="md-layout-item md-size-50 md-small-size-100">
<md-field>
<label for="graph-name">Name</label>
<md-input name="graph-name" id="graph-name"/>
</md-field>
</div>

<div class="md-layout-item md-size-50 md-small-size-100">
<md-field>
<label for="unit">Unit</label>
<md-input id="unit" name="unit"/>
</md-field>
</div>


<div class="md-layout-item md-size-50 md-small-size-100">
<md-field>
<label for="type">Type</label>
<md-select name="type" id="type">
<md-option></md-option>
<md-option value="int">int</md-option>
<md-option value="float">float</md-option>
</md-select>
</md-field>
</div>

<div class="md-layout-item md-size-50 md-small-size-100">
<md-field>
<label for="color">Color</label>
<md-select v-model="selectedColor" name="color" id="color">
<md-option value=""></md-option>
<md-option v-for="color in colors" :value="color.name">
{{ color.name }} ({{ color.colorName }})
</md-option>
</md-select>
</md-field>
</div>
</div>

</md-card-content>

<md-progress-bar md-mode="indeterminate" v-if="sending"/>

<md-card-actions>
<md-button type="submit" class="md-primary">Create Graph</md-button>
</md-card-actions>
</md-card>
</form>
</template>

<script>
import Vue from 'vue';
import {MdCard, MdField, MdButton, MdMenu, MdList, MdSnackbar} from 'vue-material/dist/components';
import {colors} from "@/pixela-colors";

Vue.use(MdCard);
Vue.use(MdField);
Vue.use(MdButton);
Vue.use(MdMenu);
Vue.use(MdList);
Vue.use(MdSnackbar);

export default {
name: 'CreateGraph',
data: () => ({
sending: false,
selectedColor: '',
colors: colors,
}),
}
;
</script>

<style scoped>

</style>