bookmarks/src/components/CreateFolder.vue

88 lines
1.6 KiB
Vue
Raw Normal View History

2019-08-15 13:38:39 +00:00
<template>
2019-08-26 12:57:02 +00:00
<div class="create-folder">
<span class="create-folder__title">
<figure class="icon-folder create-folder__icon" />
2019-08-26 12:29:07 +00:00
<input
ref="input"
2019-08-26 12:29:07 +00:00
v-model="title"
type="text"
:disabled="loading"
:placeholder="t('bookmarks', 'Enter folder title')"
2019-08-26 12:29:07 +00:00
@keyup.enter="submit"
>
</span>
<Actions>
<ActionButton
:icon="loading ? 'icon-loading' : 'icon-checkmark'"
@click="submit"
>
Create
</ActionButton>
</Actions>
2019-08-26 12:29:07 +00:00
</div>
2019-08-15 13:38:39 +00:00
</template>
<script>
import { Actions, ActionButton } from 'nextcloud-vue';
2019-08-26 12:29:07 +00:00
import { actions } 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: ''
};
},
computed: {
loading() {
return this.$store.state.loading.createFolder;
}
},
mounted() {
this.$refs['input'].focus();
},
2019-08-15 13:38:39 +00:00
methods: {
submit() {
const parentFolder = this.$route.params.folder;
this.$store.dispatch(actions.CREATE_FOLDER, {
parentFolder,
title: this.title
});
}
}
};
</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 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 12:57:02 +00:00
.create-folder__title {
2019-08-15 13:38:39 +00:00
display: flex;
flex-grow: 1;
}
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 12:57:02 +00:00
.create-folder button {
2019-08-15 13:38:39 +00:00
height: 20px;
}
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>