Skip to content

Commit 721efb3

Browse files
sunkupraimund-schluessler
authored andcommitted
Add toggle options button
Signed-off-by: Sunik Kupfer <[email protected]>
1 parent d163e8c commit 721efb3

File tree

1 file changed

+81
-4
lines changed

1 file changed

+81
-4
lines changed

src/components/AppSidebar/RepeatItem.vue

+81-4
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,36 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
2828
</div>
2929
<RepeatSummary class="property-repeat__summary__content"
3030
:recurrence-rule="recurrence" />
31+
<Actions>
32+
<ActionButton @click="toggleOptions">
33+
<template #icon>
34+
<component :is="toggleIcon" :size="20" decorative />
35+
</template>
36+
{{ toggleTitle }}
37+
</ActionButton>
38+
</Actions>
39+
40+
<div v-if="showOptions" class="property-repeat__options">
41+
options
42+
</div>
3143
</div>
3244
</template>
3345

3446
<script>
3547

3648
import { translate as t } from '@nextcloud/l10n'
3749
import RepeatSummary from './RepeatItem/RepeatSummary.vue'
50+
import Pencil from 'vue-material-design-icons/Pencil.vue'
51+
import Check from 'vue-material-design-icons/Check.vue'
52+
import { NcActions as Actions, NcActionButton as ActionButton } from '@nextcloud/vue'
3853

3954
export default {
4055
components: {
4156
RepeatSummary,
57+
Actions,
58+
ActionButton,
59+
Pencil,
60+
Check,
4261
},
4362
props: {
4463
recurrence: {
@@ -58,8 +77,43 @@ export default {
5877
default: null,
5978
},
6079
},
80+
data() {
81+
return {
82+
showOptions: false,
83+
}
84+
},
85+
computed: {
86+
/**
87+
* The name of the icon for the toggle options button
88+
*
89+
* @return {string}
90+
*/
91+
toggleIcon() {
92+
if (this.showOptions) {
93+
return 'Check'
94+
}
95+
return 'Pencil'
96+
},
97+
/**
98+
* The text of the toggle options button
99+
*
100+
* @return {string}
101+
*/
102+
toggleTitle() {
103+
if (this.showOptions) {
104+
return this.t('calendar', 'Save')
105+
}
106+
return this.t('calendar', 'Edit')
107+
},
108+
},
61109
methods: {
62110
t,
111+
/**
112+
* Toggle visibility of the options
113+
*/
114+
toggleOptions() {
115+
this.showOptions = !this.showOptions
116+
},
63117
},
64118
}
65119
</script>
@@ -80,10 +134,33 @@ export default {
80134
flex-shrink: 0;
81135
}
82136

83-
.property-repeat__summary__content {
84-
display: flex;
85-
align-items: center;
86-
margin-bottom: 5px;
137+
.property-repeat {
138+
width: 100%;
139+
140+
&__summary {
141+
display: flex;
142+
align-items: center;
143+
margin-bottom: 5px;
144+
145+
&__icon {
146+
width: 34px;
147+
height: 34px;
148+
margin-left: -5px;
149+
margin-right: 5px;
150+
}
151+
152+
&__content {
153+
flex: 1 auto;
154+
padding: 0 7px;
155+
overflow: hidden;
156+
text-overflow: ellipsis;
157+
white-space: nowrap;
158+
}
159+
}
160+
161+
&__options {
162+
margin-bottom: 5px;
163+
}
87164
}
88165
}
89166
</style>

0 commit comments

Comments
 (0)