diff --git a/front/src/components/ui/Pill.vue b/front/src/components/ui/Pill.vue
index 4a0e22cbf..7b7aab35b 100644
--- a/front/src/components/ui/Pill.vue
+++ b/front/src/components/ui/Pill.vue
@@ -1,5 +1,5 @@
diff --git a/front/src/components/ui/Pills.vue b/front/src/components/ui/Pills.vue
index 442cf216d..25330cedc 100644
--- a/front/src/components/ui/Pills.vue
+++ b/front/src/components/ui/Pills.vue
@@ -1,5 +1,5 @@
@@ -72,7 +137,7 @@ const edit = (value: string) =>
-
@@ -91,45 +156,39 @@ const edit = (value: string) =>
{{ value }}
-
-
-
-
- {{ value }}
-
-
-
-
+
+
+
{{ value }}
- {{ isCustom(value) ? ' ×' : ''}}
+
+
-
+
+
+
-
+ />
@@ -145,18 +204,34 @@ const edit = (value: string) =>
>.list {
position: relative;
+ // Compensation for round shapes -> https://en.wikipedia.org/wiki/Overshoot_(typography)
+ margin: 0 -4px;
+
padding:4px;
border-radius: 24px;
min-height: 48px;
min-width: 160px;
- >:is(:hover, :focus-visible) .pill-content {
- text-decoration: line-through !important;
- }
> .pill {
margin: 4px;
padding: 2px;
+ &.static {
+ text-decoration: none;
+ }
+ &.preset {
+ &:is(:hover, :focus-visible) .pill-content {
+ text-decoration: line-through;
+ }
+ .pill-content::after{
+ content:'×';
+ margin-left: 8px;
+ }
+ }
+ &.custom {
+ text-decoration: none;
+ }
+
}
>.dropdown{
position: absolute;
diff --git a/front/src/components/ui/pill.scss b/front/src/components/ui/pill.scss
index 9224ceb6d..697bf1f18 100644
--- a/front/src/components/ui/pill.scss
+++ b/front/src/components/ui/pill.scss
@@ -18,7 +18,7 @@
border-radius: 100vh;
> .pill-content {
- padding: 0.5em 0.75em;
+ padding: 0.45em 0.75em 0.55em 0.75em;
white-space: nowrap;
}
diff --git a/front/ui-docs/components/ui/pills.md b/front/ui-docs/components/ui/pills.md
index 380dec6e5..52387a9ad 100644
--- a/front/ui-docs/components/ui/pills.md
+++ b/front/ui-docs/components/ui/pills.md
@@ -19,9 +19,9 @@ const interactiveModel = ref({
});
const customModel = ref({
- current: ["#Noise", "#FieldRecording", "#Experiment"],
+ current: ["custom", "#FieldRecording", "#Experiment"],
others: ["#Melody", "#Rhythm"],
- custom: ["#Noise"],
+ custom: ["custom"],
});
@@ -40,6 +40,12 @@ The model you provide will be mutated by this component:
- `others`: these pills are currently not selected (but can be selected by the user). This prop is optional. By adding it, you allow users to change the selection.
- `custom`: these pills were created by the user. This prop is optional. Users can edit, add and remove any pill defined in this array. Note that the `custom` array should only contain pills that are either in `current` or in `others`.
+::: warning
+
+If you place custom pills into `others`, the user will be able to select, edit and delete them but not to deselect them. If there is a use case for this, we have to design a good UX for deselecting custom pills.
+
+:::
+
## No pills
```ts
@@ -93,18 +99,20 @@ const interactiveModel = ref({
## Let users add, remove and edit custom pills
+Use [reactive](https://vuejs.org/guide/essentials/reactivity-fundamentals.html#reactive-variables-with-ref) methods [such as `computed(...)`](https://vuejs.org/guide/essentials/computed.html) and `watch(...)` to query the model.
+
```ts
const customModel = ref({
- current: ["#Noise", "#FieldRecording", "#Experiment"],
+ current: ["custom", "#FieldRecording", "#Experiment"],
others: ["#Melody", "#Rhythm"],
- custom: ["#Noise"],
+ custom: ["custom"],
});
```
```vue-html
-
+
```
-
+