bookmarks/src/components/CreateFolder.vue

105 lines
1.9 KiB
Vue
Raw Normal View History

2019-08-15 13:38:39 +00:00
<template>
<div class="create-folder">
<span class="create-folder__title">
<figure class="icon-folder create-folder__icon" />
<input
ref="input"
v-model="title"
type="text"
:disabled="loading"
:placeholder="t('bookmarks', 'Enter folder title')"
@keyup.enter="submit">
</span>
<Actions>
<ActionButton
:icon="loading ? 'icon-loading' : 'icon-confirm'"
@click="submit">
{{ t('bookmarks', 'Create') }}
</ActionButton>
</Actions>
<Actions>
<ActionButton
icon="icon-close"
@click="cancel">
{{ t('bookmarks', 'Cancel') }}
</ActionButton>
</Actions>
</div>
2019-08-15 13:38:39 +00:00
</template>
<script>
import Actions from '@nextcloud/vue/dist/Components/Actions'
import ActionButton from '@nextcloud/vue/dist/Components/ActionButton'
import { actions, mutations } from '../store/'
2019-08-15 13:38:39 +00:00
export default {
name: 'CreateFolder',
components: { Actions, ActionButton },
2019-08-15 13:38:39 +00:00
data() {
return {
title: '',
}
2019-08-15 13:38:39 +00:00
},
computed: {
loading() {
return this.$store.state.loading.createFolder
},
2019-08-15 13:38:39 +00:00
},
mounted() {
this.$refs.input.focus()
},
2019-08-15 13:38:39 +00:00
methods: {
submit() {
const parentFolder = this.$route.params.folder
2019-08-15 13:38:39 +00:00
this.$store.dispatch(actions.CREATE_FOLDER, {
parentFolder,
title: this.title,
})
},
cancel() {
this.$store.commit(
mutations.DISPLAY_NEW_FOLDER,
false
)
},
},
}
2019-08-15 13:38:39 +00:00
</script>
<style>
2019-08-26 12:57:02 +00:00
.create-folder {
2019-08-15 13:38:39 +00:00
border-bottom: 1px solid var(--color-border);
padding: 5px;
display: flex;
align-items: center;
}
2019-08-26 22:41:52 +00:00
2019-08-26 12:57:02 +00:00
.create-folder__icon {
2019-08-15 13:38:39 +00:00
display: inline-block;
flex-shrink: 0;
height: 20px;
width: 20px;
background-size: cover;
margin: 0 10px;
position: relative;
top: 8px;
}
2019-08-26 22:41:52 +00:00
2019-08-26 12:57:02 +00:00
.create-folder__title {
2019-08-15 13:38:39 +00:00
display: flex;
flex-grow: 1;
}
2019-08-26 22:41:52 +00:00
2019-08-26 12:57:02 +00:00
.create-folder__title > input {
2019-08-15 13:38:39 +00:00
width: 100%;
}
2019-08-26 22:41:52 +00:00
2019-08-26 12:57:02 +00:00
.create-folder button {
2019-08-15 13:38:39 +00:00
height: 20px;
}
2019-08-26 22:41:52 +00:00
2019-08-26 12:57:02 +00:00
.create-folder input {
2019-08-15 13:38:39 +00:00
border-top: none;
border-left: none;
border-right: none;
}
</style>