-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from RadKod/feature/69
feat: ux improvements
- Loading branch information
Showing
15 changed files
with
330 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
:root { | ||
--box-shadow-01: 0 5px 30px rgba(156, 160, 171, 0.25); | ||
} | ||
|
||
.dark-mode { | ||
--box-shadow-01: 0 5px 30px rgba(0, 0, 0, 0.25); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
components/Dropdown/FilterDropdown/FilterDropdown.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
.filter-dropdown { | ||
$v-dropdown-menu: '.v-dropdown-menu'; | ||
|
||
#{$v-dropdown-menu} { | ||
&__trigger { | ||
position: relative; | ||
} | ||
|
||
&__container { | ||
padding: calc(var(--base-p-y) / 2) calc(var(--base-p-x) / 2); | ||
color: var(--color-text-02); | ||
background-color: var(--color-ui-02); | ||
border: 1px solid var(--color-border-01); | ||
border-radius: var(--border-radius-01); | ||
box-shadow: var(--box-shadow-01); | ||
margin-block-start: $spacer; | ||
} | ||
} | ||
|
||
&-trigger-button { | ||
$van-button: '.van-button'; | ||
|
||
display: flex; | ||
color: var(--color-text-02); | ||
background-color: var(--color-ui-02); | ||
border: 1px solid var(--color-border-02); | ||
|
||
#{$van-button} { | ||
&__text { | ||
display: flex; | ||
align-items: center; | ||
} | ||
} | ||
|
||
&__icon { | ||
width: 16px; | ||
height: 16px; | ||
margin-inline-end: $spacer; | ||
color: var(--color-icon-02); | ||
|
||
svg { | ||
width: 100% !important; | ||
height: 100% !important; | ||
} | ||
} | ||
} | ||
|
||
&-nav { | ||
position: relative; | ||
|
||
&-item { | ||
display: flex; | ||
align-items: flex-start; | ||
padding: calc(var(--base-p-y) / 2) calc(var(--base-p-x) / 2); | ||
color: var(--color-text-02); | ||
border-radius: var(--border-radius-01); | ||
cursor: pointer; | ||
|
||
&:hover { | ||
background-color: var(--color-hover-01); | ||
} | ||
|
||
&__icon { | ||
margin-inline-end: calc(var(--base-p-x) / 2); | ||
width: 16px; | ||
height: 16px; | ||
|
||
svg { | ||
width: 100% !important; | ||
height: 100% !important; | ||
} | ||
} | ||
|
||
&__title { | ||
font-size: var(--font-size-text-9); | ||
} | ||
} | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
components/Dropdown/FilterDropdown/FilterDropdown.component.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<template lang="pug"> | ||
.filter-dropdown.dropdown | ||
DropdownMenu( | ||
v-bind="$attrs" | ||
withDropdownCloser | ||
:direction="$attrs.direction || 'right'" | ||
:overlay="false" | ||
:is-open="isOpen" | ||
@closed="onClose" | ||
) | ||
template(#trigger) | ||
Button.filter-dropdown-trigger-button(size="small" round) | ||
template(v-if="selectedOption && Object.keys(selectedOption).length > 0") | ||
AppIcon.filter-dropdown-trigger-button__icon(:name="selectedOption.icon") | ||
span.filter-dropdown-trigger-button__title {{ selectedOption.label }} | ||
template(v-else) | ||
AppIcon.filter-dropdown-trigger-button__icon(name="tabler:list-details") | ||
span.filter-dropdown-trigger-button__title {{ title }} | ||
template(#body) | ||
nav.filter-dropdown-nav(v-if="options?.length > 0") | ||
template(v-for="(item, index) in options") | ||
.filter-dropdown-nav-item(:key="index" dropdown-closer @click="handleOptionSelect(item)") | ||
AppIcon.filter-dropdown-nav-item__icon(v-if="item.icon" :name="item.icon" :width="20" :height="20") | ||
span.filter-dropdown-nav-item__title {{ item.label }} | ||
</template> | ||
|
||
<script> | ||
import { defineComponent, ref, useContext, computed } from '@nuxtjs/composition-api' | ||
import DropdownMenu from 'v-dropdown-menu' | ||
import 'v-dropdown-menu/dist/v-dropdown-menu.css' | ||
import { AppIcon } from '@/components/Icon' | ||
import { Button } from 'vant' | ||
export default defineComponent({ | ||
components: { | ||
DropdownMenu, | ||
AppIcon, | ||
Button | ||
}, | ||
props: { | ||
title: { | ||
type: String, | ||
required: false, | ||
default: null | ||
}, | ||
options: { | ||
type: Array, | ||
required: true, | ||
default: () => [] | ||
} | ||
}, | ||
setup(props, { emit }) { | ||
const context = useContext() | ||
const isOpen = ref(false) | ||
const onClose = () => { | ||
isOpen.value = false | ||
} | ||
const triggerTitle = computed(() => props.title || context.i18n.t('general.filter')) | ||
const selectedOption = ref({}) | ||
const handleOptionSelect = option => { | ||
selectedOption.value = option | ||
emit('on-select-option', option) | ||
} | ||
return { | ||
isOpen, | ||
onClose, | ||
triggerTitle, | ||
selectedOption, | ||
handleOptionSelect | ||
} | ||
} | ||
}) | ||
</script> | ||
|
||
<style lang="scss" src="./FilterDropdown.component.scss"></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as FilterDropdown } from './FilterDropdown/FilterDropdown.component' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.