Skip to content

Commit 3d019c9

Browse files
Merge pull request #20 from HE-Arc/3-ui-element-for-addingsubstracting-parameter
3 UI element for addingsubstracting parameter
2 parents 88f7c1f + ca5420d commit 3d019c9

File tree

3 files changed

+108
-0
lines changed

3 files changed

+108
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
<!--
2+
Component to add/substract certain parameters. How to use:
3+
4+
<NumberInput :min = 5 :max = 10></NumberInput>
5+
min nad max are optional, to define limits of the changer
6+
7+
<NumberInput
8+
v-for="item in fetchedItems"
9+
:key="item.id"
10+
:value="item.someValue"
11+
></NumberInput>
12+
-->
13+
14+
<template>
15+
<button
16+
class="value-control"
17+
onclick="numberInput.stepDown()"
18+
title="Decrease value"
19+
aria-label="Decrease value">-</button>
20+
21+
<input
22+
class="value-input"
23+
type="number"
24+
v-model="inputValue"
25+
name="numberInput"
26+
:min = "min"
27+
:max = "max"
28+
id="numberInput" readonly>
29+
30+
<button
31+
class="value-control"
32+
onclick="numberInput.stepUp()"
33+
title="Increase value"
34+
aria-label="Increase value">+</button>
35+
36+
</template>
37+
38+
<style scoped>
39+
40+
.value-control {
41+
margin: 0 0.1rem;
42+
padding: 0.5rem;
43+
background: transparent;
44+
border: 0.1rem solid #817474;;
45+
border-radius: 0.3rem;
46+
color: #6c5c5c;
47+
cursor: pointer;
48+
}
49+
50+
.value-control:hover {
51+
background: #eee;
52+
}
53+
54+
.value-control:active {
55+
background: #ddd;
56+
}
57+
58+
.value-control:focus,
59+
.value-input:focus {
60+
outline: 2px solid #b90606;
61+
outline-offset: 1px
62+
}
63+
64+
.value-input {
65+
margin: 0;
66+
width: auto;
67+
border: 0.3rem double red;
68+
border-radius: 0.8rem;
69+
padding: 0.5rem;
70+
text-align: center;
71+
}
72+
73+
.value-input:hover {
74+
border-color: #777;
75+
}
76+
</style>
77+
78+
<script>
79+
export default {
80+
props: {
81+
min: {
82+
type: Number,
83+
default: 0, // Default min value
84+
},
85+
max: {
86+
type: Number,
87+
default: 10, // Default max value
88+
},
89+
},
90+
data() {
91+
return {
92+
inputValue: this.value,
93+
};
94+
},
95+
watch: {
96+
value(newVal) {
97+
this.inputValue = newVal;
98+
},
99+
},
100+
};
101+
</script>

frontend/src/components/functional/NumberSpinner.vue

Whitespace-only changes.

frontend/src/views/HomeView.vue

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ const deleteCharacter = async (id) => {
3030
</script>
3131
<template>
3232
<div>
33+
<div class="container mx-auto px-2 py-4">
34+
<h1 class="text-4xl font-bold mb-8">Character List - How does it work?</h1>
35+
</div>
36+
<div class="container mx-auto px-2 py-4">
37+
<p>On this page, you see the list of (currently all existent, but later-) the characters you or your friends created. You can create new ones, delete existent, or click them to see and edit their full character sheet (currently not present).</p>
38+
</div>
39+
3340
<div class="flex justify-end mb-4">
3441
<router-link :to="{ name: 'character-new' }" class="ff-button">Add Character</router-link>
3542
</div>

0 commit comments

Comments
 (0)