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

[WIP] vuetify2で一応最低限動かせる所まで #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions config/storybook/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
createStore,
ClassBasedStoreOption
} from '@/store/root'
import vuetify from '@/vuetify'

addDecorator(() => {
const container = new Container()
Expand All @@ -31,6 +32,7 @@ addDecorator(() => {

return {
template: "<v-app><story/></v-app>",
vuetify,
store,
router: new Router()
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"vue-proxy-component": "0.0.8",
"vue-router": "3.0.2",
"vue-router-layout": "0.1.3",
"vuetify": "1.5.0",
"vuetify": "^2.0.0",
"vuex": "3.1.0",
"vuex-router-sync": "5.0.0"
},
Expand Down
29 changes: 5 additions & 24 deletions src/components/containers/loggedInHeader.vue
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
<template>
<v-toolbar
color="dark"
dark
app
:clipped-left="$vuetify.breakpoint.mdAndUp"
fixed
>
<v-app-bar color="dark" dark :clipped-left="$vuetify.breakpoint.mdAndUp" fixed>
<v-toolbar-title style="width: 300px" class="ml-0 pl-3" @click="toHome()">
<v-toolbar-side-icon
@click.stop="toggleDrawer()"/>
<v-app-bar-nav-icon @click.stop="toggleDrawer()" />
<span>Book Management</span>
</v-toolbar-title>

<v-text-field
flat
solo-inverted
prepend-icon="search"
label="Search"
class="hidden-sm-and-down"
></v-text-field>
<v-spacer/>
<v-spacer />

<v-avatar size="36px" @click="openDialog()" class="clickable">
<img
width="36"
height="36"
:src="user.iconFilepath"
class="user-icon-img">
<img width="36" height="36" :src="user.iconFilepath" class="user-icon-img" />
</v-avatar>

</v-toolbar>
</v-app-bar>
</template>

<script lang="ts">
Expand Down
70 changes: 17 additions & 53 deletions src/components/containers/navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,62 +9,22 @@
>
<v-list dense>
<template v-for="item in items">
<v-layout
row
v-if="item.heading"
align-center
:key="item.heading"
>
<v-flex xs6>
<v-subheader v-if="item.heading">
{{ item.heading }}
</v-subheader>
</v-flex>
<v-flex xs6 class="text-xs-center">
<a href="#!" class="body-2 black--text">EDIT</a>
</v-flex>
</v-layout>
<v-list-group
v-else-if="item.children"
v-model="item.model"
:key="item.text"
:prepend-icon="item.model ? item.icon : item['icon-alt']"
append-icon=""
>
<v-list-tile slot="activator">
<v-list-tile-content>
<v-list-tile-title>
{{ item.text }}
</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
<v-list-tile
v-for="(child, i) in item.children"
:key="i"
@click="item.action && fire(item.action)"
>
<v-list-tile-action v-if="child.icon">
<v-icon>{{ child.icon }}</v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>
{{ child.text }}
</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</v-list-group>
<v-list-tile v-else @click="item.action && fire(item.action)" :key="item.text">
<v-list-tile-action>
<v-list-item link :key="item.text" @click="fire(item.action)">
<v-list-item-icon v-if="item.icon">
<v-icon>{{ item.icon }}</v-icon>
</v-list-tile-action>
<v-list-tile-content>
<v-list-tile-title>
{{ item.text }}
</v-list-tile-title>
</v-list-tile-content>
</v-list-tile>
</v-list-item-icon>
<v-list-item-content>
<v-list-item-title>{{ item.text }}</v-list-item-title>
</v-list-item-content>
</v-list-item>
</template>
</v-list>

<template v-slot:append>
<div class="pa-2" @click="logout()">
<v-btn block>Logout</v-btn>
</div>
</template>
</v-navigation-drawer>
</template>

Expand Down Expand Up @@ -99,5 +59,9 @@ export default class Navigation extends Vue {
this.$store.dispatch(closeDrawer())
action()
}

public logout() {
alert('実装されてません')
}
}
</script>
24 changes: 6 additions & 18 deletions src/components/containers/unloggedInHeader.vue
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
<template>
<v-toolbar
color="primary"
dark
app
:clipped-left="$vuetify.breakpoint.mdAndUp"
fixed>
<v-app-bar color="primary" dark :clipped-left="$vuetify.breakpoint.mdAndUp" fixed>
<v-toolbar-title style="width: 300px" class="ml-0 pl-3">
<span>Book Management</span>
</v-toolbar-title>
<v-spacer/>
<v-spacer />

<v-btn
v-if="$route.path.includes('/user/login')"
color="primary lighten-1"
@click="toRegistrationPage()">
アカウントを作成
</v-btn>
@click="toRegistrationPage()"
>アカウントを作成</v-btn>

<v-btn
v-else
color="primary lighten-1"
@click="toLoginPage()">
ログイン
</v-btn>

</v-toolbar>
<v-btn v-else color="primary lighten-1" @click="toLoginPage()">ログイン</v-btn>
</v-app-bar>
</template>

<script lang="ts">
Expand Down
55 changes: 18 additions & 37 deletions src/components/organisms/createBookForm.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<v-card class="elevation-12" dark>
<v-toolbar card dark>
<v-app-bar flat dark>
<v-btn icon dark @click="cancel()">
<v-icon>close</v-icon>
</v-btn>
<v-toolbar-title>Registration Book</v-toolbar-title>
</v-toolbar>
</v-app-bar>

<v-card-text>
<v-form ref="form" v-model="valid" lazy-validation>
Expand All @@ -32,7 +32,8 @@
:rules="titleRules"
prepend-icon="subject"
label="タイトル"
type="text" />
type="text"
/>
</v-flex>
</v-layout>

Expand All @@ -43,7 +44,8 @@
:rules="priceRules"
prepend-icon="attach_money"
label="価格"
type="text" />
type="text"
/>
</v-flex>
</v-layout>

Expand All @@ -53,9 +55,7 @@
<p>所有者</p>
<v-btn-toggle color="primary" v-model="owner">
<template v-for="owner in ownerList">
<v-btn flat :value="owner" :key="owner">
{{ owner | ownerFilter }}
</v-btn>
<v-btn text :value="owner" :key="owner">{{ owner | ownerFilter }}</v-btn>
</template>
</v-btn-toggle>
</v-flex>
Expand All @@ -70,9 +70,7 @@
<p>購入場所</p>
<v-btn-toggle color="primary" v-model="purchasedLocation">
<template v-for="location in purchasedLocationList">
<v-btn flat :value="location" :key="location">
{{ location }}
</v-btn>
<v-btn text :value="location" :key="location">{{ location }}</v-btn>
</template>
</v-btn-toggle>
</v-flex>
Expand All @@ -87,9 +85,7 @@
<p>種類</p>
<v-btn-toggle color="primary" v-model="type">
<template v-for="bookType in bookTypeList">
<v-btn flat :value="bookType" :key="bookType">
{{ bookType | bookTypeFilter }}
</v-btn>
<v-btn text :value="bookType" :key="bookType">{{ bookType | bookTypeFilter }}</v-btn>
</template>
</v-btn-toggle>
</v-flex>
Expand All @@ -102,22 +98,13 @@
<p>購入日時</p>
<v-layout row wrap>
<v-flex xs2 md1>
<v-select
v-model="purchasedYear"
:items="years"
solo/>
<v-select v-model="purchasedYear" :items="years" solo />
</v-flex>
<v-flex xs2 md1>
<v-select
v-model="purchasedMonth"
:items="months"
solo/>
<v-select v-model="purchasedMonth" :items="months" solo />
</v-flex>
<v-flex xs2 md1>
<v-select
v-model="purchasedDay"
:items="days"
solo/>
<v-select v-model="purchasedDay" :items="days" solo />
</v-flex>
</v-layout>
</v-flex>
Expand All @@ -131,7 +118,8 @@
no-resize
:rows="rows"
label="説明文"
color="primary" />
color="primary"
/>
</v-flex>

<SpaceStick width="12" />
Expand All @@ -140,19 +128,12 @@
<Markdown :source="description || 'プレビュー'" />
</v-flex>
</v-layout>

</v-form>

</v-card-text>

<v-card-actions>
<v-spacer/>
<v-btn
:disabled="!valid"
@click="submit()"
color="secondary">
登録
</v-btn>
<v-spacer />
<v-btn :disabled="!valid" @click="submit()" color="secondary">登録</v-btn>
</v-card-actions>
</v-card>
</template>
Expand Down Expand Up @@ -198,10 +179,10 @@ export default class CreateBookForm extends Vue {
form: VForm,
}

@Prop({required: true})
@Prop({ required: true })
public createBook!: (params: IRegistrationParams) => void

@Prop({required: true})
@Prop({ required: true })
public user!: IUser

public valid = true
Expand Down
15 changes: 5 additions & 10 deletions src/components/organisms/loginForm.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<v-card class="elevation-12">
<v-toolbar dark color="primary">
<v-app-bar dark color="primary">
<v-toolbar-title>ログインフォーム</v-toolbar-title>
</v-toolbar>
</v-app-bar>
<v-card-text>
<v-form ref="form" v-model="valid" lazy-validation>
<v-text-field
Expand All @@ -27,13 +27,8 @@
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer/>
<v-btn
:disabled="!valid"
@click="submit()"
color="primary">
ログイン
</v-btn>
<v-spacer />
<v-btn :disabled="!valid" @click="submit()" color="primary">ログイン</v-btn>
</v-card-actions>
</v-card>
</template>
Expand All @@ -48,7 +43,7 @@ export default class LoginPage extends Vue {
form: VForm,
}

@Prop({required: true}) public login!: (email: string, password: string) => Promise<void>
@Prop({ required: true }) public login!: (email: string, password: string) => Promise<void>

public valid = true
public email = ''
Expand Down
Loading