Browse Source

Update BaseCard component

pull/341/head
Hironsan 5 years ago
parent
commit
36297ba840
2 changed files with 27 additions and 31 deletions
  1. 27
      frontend/components/molecules/BaseCard.vue
  2. 31
      frontend/components/organisms/LoginForm.vue

27
frontend/components/molecules/BaseCard.vue

@ -1,18 +1,18 @@
<template> <template>
<v-card> <v-card>
<v-card-title class="grey lighten-2">
{{ title }}
</v-card-title>
<v-container grid-list-sm>
<v-layout wrap>
<v-flex xs12>
<slot name="content" />
</v-flex>
</v-layout>
</v-container>
<v-toolbar
color="primary white--text"
flat
>
<v-toolbar-title>{{ title }}</v-toolbar-title>
</v-toolbar>
<v-card-text class="text--primary mt-3 pl-4">
<slot name="content" />
</v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer /> <v-spacer />
<v-btn <v-btn
v-if="cancelText"
class="text-capitalize" class="text-capitalize"
text text
color="primary" color="primary"
@ -22,6 +22,7 @@
{{ cancelText }} {{ cancelText }}
</v-btn> </v-btn>
<v-btn <v-btn
v-if="agreeText"
class="text-none" class="text-none"
text text
:disabled="disabled" :disabled="disabled"
@ -44,13 +45,11 @@ export default {
}, },
cancelText: { cancelText: {
type: String, type: String,
default: '',
required: true
default: ''
}, },
agreeText: { agreeText: {
type: String, type: String,
default: '',
required: true
default: ''
}, },
disabled: { disabled: {
type: Boolean, type: Boolean,

31
frontend/components/organisms/LoginForm.vue

@ -1,9 +1,11 @@
<template> <template>
<v-card class="elevation-12">
<v-toolbar color="primary" dark flat>
<v-toolbar-title>Login</v-toolbar-title>
</v-toolbar>
<v-card-text>
<base-card
title="Login"
agree-text="Login"
:disabled="!valid"
@agree="tryLogin"
>
<template #content>
<v-form <v-form
ref="form" ref="form"
v-model="valid" v-model="valid"
@ -26,24 +28,19 @@
type="password" type="password"
/> />
</v-form> </v-form>
</v-card-text>
<v-card-actions>
<div class="flex-grow-1" />
<v-btn
:disabled="!valid"
color="primary"
@click="tryLogin"
>
Login
</v-btn>
</v-card-actions>
</v-card>
</template>
</base-card>
</template> </template>
<script> <script>
import { userNameRules, passwordRules } from '@/rules/index' import { userNameRules, passwordRules } from '@/rules/index'
import BaseCard from '@/components/molecules/BaseCard'
export default { export default {
components: {
BaseCard
},
props: { props: {
login: { login: {
type: Function, type: Function,

Loading…
Cancel
Save