chore: Update design for filters (#3423)
This commit is contained in:
parent
330a97b5c5
commit
c23e2c23d4
10 changed files with 161 additions and 138 deletions
|
@ -49,7 +49,17 @@ code {
|
||||||
.cursor-pointer {
|
.cursor-pointer {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove when grid gutters are fixed
|
// remove when grid gutters are fixed
|
||||||
.columns.with-right-space {
|
.columns.with-right-space {
|
||||||
padding-right: var(--space-normal);
|
padding-right: var(--space-normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.padding-right-small {
|
||||||
|
padding-right: var(--space-one);
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-right-small {
|
||||||
|
margin-right: var(--space-small);
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ $default-button-height: 4.0rem;
|
||||||
// @TODDO - Remove after moving all buttons to woot-button
|
// @TODDO - Remove after moving all buttons to woot-button
|
||||||
.icon+.button__content {
|
.icon+.button__content {
|
||||||
padding-left: var(--space-small);
|
padding-left: var(--space-small);
|
||||||
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.expanded {
|
&.expanded {
|
||||||
|
@ -103,7 +104,6 @@ $default-button-height: 4.0rem;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,11 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 60rem;
|
width: 60rem;
|
||||||
|
|
||||||
|
&.medium {
|
||||||
|
max-width: 80%;
|
||||||
|
width: 90rem;
|
||||||
|
}
|
||||||
|
|
||||||
.content-box {
|
.content-box {
|
||||||
@include padding($zero);
|
@include padding($zero);
|
||||||
height: auto;
|
height: auto;
|
||||||
|
@ -94,6 +99,7 @@
|
||||||
|
|
||||||
.delete-item {
|
.delete-item {
|
||||||
@include padding($space-large);
|
@include padding($space-large);
|
||||||
|
|
||||||
button {
|
button {
|
||||||
@include margin($zero);
|
@include margin($zero);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ l<template>
|
||||||
<woot-modal
|
<woot-modal
|
||||||
:show.sync="showAdvancedFilters"
|
:show.sync="showAdvancedFilters"
|
||||||
:on-close="onToggleAdvanceFiltersModal"
|
:on-close="onToggleAdvanceFiltersModal"
|
||||||
|
size="medium"
|
||||||
>
|
>
|
||||||
<conversation-advanced-filter
|
<conversation-advanced-filter
|
||||||
v-if="showAdvancedFilters"
|
v-if="showAdvancedFilters"
|
||||||
|
|
|
@ -34,6 +34,10 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: 'centered',
|
default: 'centered',
|
||||||
},
|
},
|
||||||
|
size: {
|
||||||
|
type: String,
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
modalContainerClassName() {
|
modalContainerClassName() {
|
||||||
|
@ -41,7 +45,8 @@ export default {
|
||||||
if (this.fullWidth) {
|
if (this.fullWidth) {
|
||||||
return `${className} modal-container--full-width`;
|
return `${className} modal-container--full-width`;
|
||||||
}
|
}
|
||||||
return className;
|
|
||||||
|
return `${className} ${this.size}`;
|
||||||
},
|
},
|
||||||
modalClassName() {
|
modalClassName() {
|
||||||
const modalClassNameMap = {
|
const modalClassNameMap = {
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<p>{{ $t('FILTER.SUBTITLE') }}</p>
|
<p>{{ $t('FILTER.SUBTITLE') }}</p>
|
||||||
</woot-modal-header>
|
</woot-modal-header>
|
||||||
<div class="row modal-content">
|
<div class="row modal-content">
|
||||||
<div class="medium-12 columns">
|
<div class="medium-12 columns filters-wrap">
|
||||||
<filter-input-box
|
<filter-input-box
|
||||||
v-for="(filter, i) in appliedFilters"
|
v-for="(filter, i) in appliedFilters"
|
||||||
:key="i"
|
:key="i"
|
||||||
|
@ -20,11 +20,18 @@
|
||||||
@removeFilter="removeFilter(i)"
|
@removeFilter="removeFilter(i)"
|
||||||
/>
|
/>
|
||||||
<div class="filter-actions">
|
<div class="filter-actions">
|
||||||
<button class="append-filter-btn" @click="appendNewFilter">
|
<woot-button
|
||||||
<i class="icon ion-plus-circled margin-right-small" />
|
icon="ion-plus"
|
||||||
<span>{{ $t('FILTER.ADD_NEW_FILTER') }}</span>
|
color-scheme="success"
|
||||||
</button>
|
variant="smooth"
|
||||||
|
size="small"
|
||||||
|
@click="appendNewFilter"
|
||||||
|
>
|
||||||
|
{{ $t('FILTER.ADD_NEW_FILTER') }}
|
||||||
|
</woot-button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="medium-12 columns">
|
||||||
<div class="modal-footer justify-content-end w-full">
|
<div class="modal-footer justify-content-end w-full">
|
||||||
<woot-button class="button clear" @click.prevent="onClose">
|
<woot-button class="button clear" @click.prevent="onClose">
|
||||||
{{ $t('FILTER.CANCEL_BUTTON_LABEL') }}
|
{{ $t('FILTER.CANCEL_BUTTON_LABEL') }}
|
||||||
|
@ -203,79 +210,16 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
<style>
|
.filters-wrap {
|
||||||
.filter-modal-content {
|
padding: var(--space-normal);
|
||||||
|
border-radius: var(--border-radius-large);
|
||||||
border: 1px solid var(--color-border);
|
border: 1px solid var(--color-border);
|
||||||
border-radius: var(--space-half);
|
background: var(--color-background-light);
|
||||||
padding: var(--space-one);
|
margin-bottom: var(--space-normal);
|
||||||
}
|
|
||||||
.filter--attributes {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: var(--space-one);
|
|
||||||
}
|
|
||||||
.filter--attribute_clearbtn {
|
|
||||||
font-size: var(--space-two);
|
|
||||||
margin-left: var(--space-one);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.filter--attributes_select {
|
|
||||||
margin-bottom: var(--space-zero) !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.filter--values_select {
|
|
||||||
margin-bottom: var(--space-zero) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.padding-right-small {
|
|
||||||
padding-right: var(--space-one);
|
|
||||||
}
|
|
||||||
.margin-right-small {
|
|
||||||
margin-right: var(--space-three-fourths);
|
|
||||||
}
|
|
||||||
.append-filter-btn {
|
|
||||||
width: 100%;
|
|
||||||
border: 1px solid var(--color-border);
|
|
||||||
border-radius: var(--space-one-fourths);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
color: var(--color-woot);
|
|
||||||
font-size: var(--font-size-one-and-half);
|
|
||||||
padding: var(--space-one);
|
|
||||||
height: var(----space-medium);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
.filter-actions {
|
.filter-actions {
|
||||||
margin: var(--space-two) var(--space-zero) var(--space-one) var(--space-zero);
|
margin-top: var(--space-normal);
|
||||||
}
|
|
||||||
.filter--attributes_input {
|
|
||||||
margin-bottom: var(--space-zero) !important;
|
|
||||||
}
|
|
||||||
.filter--query_operator {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
position: relative;
|
|
||||||
margin: var(--space-one) var(--space-zero);
|
|
||||||
}
|
|
||||||
.filter--query_operator_line {
|
|
||||||
position: absolute;
|
|
||||||
z-index: var(--z-index-low);
|
|
||||||
width: 100%;
|
|
||||||
border-bottom: 1px solid var(--color-border);
|
|
||||||
}
|
|
||||||
.filter--query_operator_container {
|
|
||||||
position: relative;
|
|
||||||
z-index: var(--z-index-twenty);
|
|
||||||
margin: var(--space-zero);
|
|
||||||
}
|
|
||||||
.filter--query_operator_select {
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: var(--space-zero) !important;
|
|
||||||
border: none;
|
|
||||||
padding: var(--space-zero) var(--space-three) var(--space-zero)
|
|
||||||
var(--space-two);
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="filters">
|
<div class="filters">
|
||||||
<div class="filter--attributes">
|
<div class="filter">
|
||||||
|
<div class="filter-inputs">
|
||||||
<select
|
<select
|
||||||
v-model="attribute_key"
|
v-model="attributeKey"
|
||||||
class="filter--attributes_select"
|
class="filter__question"
|
||||||
@change="resetFilter()"
|
@change="resetFilter()"
|
||||||
>
|
>
|
||||||
<option
|
<option
|
||||||
|
@ -14,17 +15,8 @@
|
||||||
{{ $t(`FILTER.ATTRIBUTES.${attribute.attributeI18nKey}`) }}
|
{{ $t(`FILTER.ATTRIBUTES.${attribute.attributeI18nKey}`) }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
<button class="filter--attribute_clearbtn" @click="removeFilter">
|
|
||||||
<i class="icon ion-close-circled" />
|
<select v-model="filterOperator" class="filter__operator">
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="filter-values">
|
|
||||||
<div class="row">
|
|
||||||
<div
|
|
||||||
class="columns padding-right-small"
|
|
||||||
:class="showUserInput ? 'small-4' : 'small-12'"
|
|
||||||
>
|
|
||||||
<select v-model="filter_operator" class="filter--values_select">
|
|
||||||
<option
|
<option
|
||||||
v-for="(operator, o) in operators"
|
v-for="(operator, o) in operators"
|
||||||
:key="o"
|
:key="o"
|
||||||
|
@ -33,8 +25,8 @@
|
||||||
{{ $t(`FILTER.OPERATOR_LABELS.${operator.value}`) }}
|
{{ $t(`FILTER.OPERATOR_LABELS.${operator.value}`) }}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
<div v-if="showUserInput" class="small-8 columns">
|
<div v-if="showUserInput" class="filter__answer--wrap">
|
||||||
<div
|
<div
|
||||||
v-if="inputType === 'multi_select'"
|
v-if="inputType === 'multi_select'"
|
||||||
class="multiselect-wrap--small"
|
class="multiselect-wrap--small"
|
||||||
|
@ -73,19 +65,25 @@
|
||||||
v-else
|
v-else
|
||||||
v-model="values"
|
v-model="values"
|
||||||
type="text"
|
type="text"
|
||||||
class="filter--attributes_input"
|
class="answer--text-input"
|
||||||
placeholder="Enter value"
|
placeholder="Enter value"
|
||||||
/>
|
/>
|
||||||
<div v-if="v.values.$dirty && v.values.$error" class="filter-error">
|
</div>
|
||||||
|
<woot-button
|
||||||
|
icon="ion-close"
|
||||||
|
variant="clear"
|
||||||
|
color-scheme="secondary"
|
||||||
|
@click="removeFilter"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<p v-if="v.values.$dirty && v.values.$error" class="filter-error">
|
||||||
{{ $t('FILTER.EMPTY_VALUE_ERROR') }}
|
{{ $t('FILTER.EMPTY_VALUE_ERROR') }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</div>
|
<div v-if="showQueryOperator" class="filter__join-operator">
|
||||||
</div>
|
<hr class="operator__line" />
|
||||||
<div v-if="showQueryOperator" class="filter--query_operator">
|
<select v-model="query_operator" class="operator__select">
|
||||||
<hr class="filter--query_operator_line" />
|
|
||||||
<div class="filter--query_operator_container">
|
|
||||||
<select v-model="query_operator" class="filter--query_operator_select">
|
|
||||||
<option value="and">
|
<option value="and">
|
||||||
{{ $t('FILTER.QUERY_DROPDOWN_LABELS.AND') }}
|
{{ $t('FILTER.QUERY_DROPDOWN_LABELS.AND') }}
|
||||||
</option>
|
</option>
|
||||||
|
@ -95,7 +93,6 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -135,7 +132,7 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
attribute_key: {
|
attributeKey: {
|
||||||
get() {
|
get() {
|
||||||
if (!this.value) return null;
|
if (!this.value) return null;
|
||||||
return this.value.attribute_key;
|
return this.value.attribute_key;
|
||||||
|
@ -145,7 +142,7 @@ export default {
|
||||||
this.$emit('input', { ...payload, attribute_key: value });
|
this.$emit('input', { ...payload, attribute_key: value });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
filter_operator: {
|
filterOperator: {
|
||||||
get() {
|
get() {
|
||||||
if (!this.value) return null;
|
if (!this.value) return null;
|
||||||
return this.value.filter_operator;
|
return this.value.filter_operator;
|
||||||
|
@ -186,12 +183,75 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
<style scoped>
|
.filter {
|
||||||
.multiselect {
|
background: var(--color-background);
|
||||||
margin-bottom: var(--space-zero) !important;
|
padding: var(--space-small);
|
||||||
|
border: 1px solid var(--color-border);
|
||||||
|
border-radius: var(--border-radius-medium);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filter-inputs {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.filter-error {
|
.filter-error {
|
||||||
color: var(--r-500);
|
color: var(--r-500);
|
||||||
|
display: block;
|
||||||
|
margin: var(--space-smaller) 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter__question,
|
||||||
|
.filter__operator {
|
||||||
|
margin-bottom: var(--space-zero);
|
||||||
|
margin-right: var(--space-smaller);
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter__question {
|
||||||
|
max-width: 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter__operator {
|
||||||
|
max-width: 20%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter__answer--wrap {
|
||||||
|
margin-right: var(--space-smaller);
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
.filter__answer {
|
||||||
|
&.answer--text-input {
|
||||||
|
margin-bottom: var(--space-zero);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter__join-operator-wrap {
|
||||||
|
position: relative;
|
||||||
|
z-index: var(--z-index-twenty);
|
||||||
|
margin: var(--space-zero);
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter__join-operator {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
position: relative;
|
||||||
|
margin: var(--space-one) var(--space-zero);
|
||||||
|
|
||||||
|
.operator__line {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
border-bottom: 1px solid var(--color-border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.operator__select {
|
||||||
|
position: relative;
|
||||||
|
width: auto;
|
||||||
|
margin-bottom: var(--space-zero) !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.multiselect {
|
||||||
|
margin-bottom: var(--space-zero);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"FILTER": {
|
"FILTER": {
|
||||||
"TITLE": "Filter Conversations",
|
"TITLE": "Filter Conversations",
|
||||||
"SUBTITLE": "Add filters below and hit 'Submit' to filter conversations.",
|
"SUBTITLE": "Add filters below and hit 'Apply filters' to filter conversations.",
|
||||||
"ADD_NEW_FILTER": "Add Filter",
|
"ADD_NEW_FILTER": "Add Filter",
|
||||||
"FILTER_DELETE_ERROR": "You should have atleast one filter to save",
|
"FILTER_DELETE_ERROR": "You should have atleast one filter to save",
|
||||||
"SUBMIT_BUTTON_LABEL": "Submit",
|
"SUBMIT_BUTTON_LABEL": "Apply filters",
|
||||||
"CANCEL_BUTTON_LABEL": "Cancel",
|
"CANCEL_BUTTON_LABEL": "Cancel",
|
||||||
"CLEAR_BUTTON_LABEL": "Clear Filters",
|
"CLEAR_BUTTON_LABEL": "Clear Filters",
|
||||||
"EMPTY_VALUE_ERROR": "Value is required",
|
"EMPTY_VALUE_ERROR": "Value is required",
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
--font-size-micro: 1rem;
|
--font-size-micro: 1rem;
|
||||||
--font-size-mini: 1.2rem;
|
--font-size-mini: 1.2rem;
|
||||||
--font-size-small: 1.4rem;
|
--font-size-small: 1.4rem;
|
||||||
--font-size-one-and-half: 1.5rem;
|
|
||||||
--font-size-default: 1.6rem;
|
--font-size-default: 1.6rem;
|
||||||
--font-size-medium: 1.8rem;
|
--font-size-medium: 1.8rem;
|
||||||
--font-size-two: 2rem;
|
--font-size-two: 2rem;
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
// spaces
|
// spaces
|
||||||
--space-zero: 0;
|
--space-zero: 0;
|
||||||
--space-micro: 0.2rem;
|
--space-micro: 0.2rem;
|
||||||
--space-one-fourths: 0.25rem;
|
|
||||||
--space-smaller: 0.4rem;
|
--space-smaller: 0.4rem;
|
||||||
--space-half: 0.5rem;
|
--space-half: 0.5rem;
|
||||||
--space-three-fourths: 0.75rem;
|
|
||||||
--space-small: 0.8rem;
|
--space-small: 0.8rem;
|
||||||
--space-one: 1rem;
|
--space-one: 1rem;
|
||||||
--space-slab: 1.2rem;
|
--space-slab: 1.2rem;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue