Skip to content

Commit

Permalink
chore: APPS-3112 unify styles between datefilter and filterdropdown (#…
Browse files Browse the repository at this point in the history
…669)

* chore: unify styles between datefilter and filterdropdown

* chore: cleanup comment

* chore: tweak styles

* chore: more style tweaks

---------

Co-authored-by: Jess Divers <[email protected]>
  • Loading branch information
farosFreed and Jess Divers authored Dec 19, 2024
1 parent a2d099c commit cee21bd
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 16 deletions.
18 changes: 13 additions & 5 deletions src/lib-components/DateFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ onMounted(() => {
>
<template #input-icon>
<SvgIconFTVACalender />
<span :class="inputIconClass">
<!-- <span :class="inputIconClass">
<SvgIconFTVADropTriangle />
</span>
</span> -->
</template>

<template #clear-icon="{ clear }">
Expand Down Expand Up @@ -477,9 +477,17 @@ onMounted(() => {
// Input styling
:deep(.dp__input) {
height: 59px;
font-family: var(--font-secondary);
font-family: var(--font-primary);
font-weight: 500;
font-size: 18px;
color: $medium-grey;
border-radius: 8px;
&:hover, &:focus {
border-color: #ddd;
}
&:hover {
background-color: #f1f1f1;
}
@media #{$small} {
padding-inline-start: 57px;
Expand All @@ -496,7 +504,7 @@ onMounted(() => {
svg {
position: absolute;
right: 40px;
right: 30px;
transform: translateY(-50%);
@media #{$small} {
Expand Down Expand Up @@ -817,7 +825,7 @@ onMounted(() => {
.mobile-button {
width: 166px;
padding: 6px;
border-radius: 4px;
// border: none;
&:active {
color: white;
Expand Down
26 changes: 21 additions & 5 deletions src/lib-components/FiltersDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script setup lang="ts">
import { computed } from 'vue'
import { computed, onMounted, ref, watch } from 'vue'
import type { PropType } from 'vue'
import SvgGlyphX from 'ucla-library-design-tokens/assets/svgs/icon-ftva-xtag.svg'
import SvgFilterIcon from 'ucla-library-design-tokens/assets/svgs/icon-ftva-filter.svg'
import { useWindowSize } from '@vueuse/core'
import BlockTag from './BlockTag.vue'
import ButtonLink from './ButtonLink.vue'
import MobileDrawer from './MobileDrawer.vue'
Expand Down Expand Up @@ -57,17 +58,29 @@ function onDoneClick() {
// THEME
const theme = useTheme()
const isMobile = ref(false)
const parsedClasses = computed(() => {
return ['filters-dropdown', theme?.value || '']
})
onMounted(() => {
const { width } = useWindowSize()
watch(width, (newWidth) => {
isMobile.value = newWidth <= 750
}, { immediate: true })
})
</script>

<template>
<div :class="parsedClasses">
<MobileDrawer>
<template #buttonLabel>
<div class="filter-summary">
Filters ({{ numOfSelectedFilters }} selected )
<template v-if="!isMobile">
Filters ({{ numOfSelectedFilters }} selected )
</template>
<template v-else>
Filters
</template>
</div>
<span class="icon-svg">
<SvgFilterIcon aria-hidden="true" />
Expand All @@ -82,8 +95,8 @@ const parsedClasses = computed(() => {
<label v-for="option in group.options" :key="option" class="pill-label">
<!-- Hidden checkbox for managing selection & screen-reader user interaction -->
<input
:id="option" v-model="selectedFilters[group.searchField]" type="checkbox" class="pill-checkbox" :name="option"
:value="option"
:id="option" v-model="selectedFilters[group.searchField]" type="checkbox" class="pill-checkbox"
:name="option" :value="option"
>
<!-- BlockTag component for display -->
<BlockTag :label="option" :is-secondary="true">
Expand All @@ -96,7 +109,10 @@ const parsedClasses = computed(() => {
</div>
</div>
<div class="action-row">
<ButtonLink class="action-row-button select-button" label="Done" icon-name="none" @click="onDoneClick(); removeOverlay();" />
<ButtonLink
class="action-row-button select-button" label="Done" icon-name="none"
@click="onDoneClick(); removeOverlay();"
/>
<ButtonLink
class="action-row-button clear-button" label="Clear" icon-name="icon-close"
@click="clearFilters"
Expand Down
17 changes: 17 additions & 0 deletions src/styles/default/_filters-dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Dropdown Window Size & Input
:deep(.mobile-button) {
min-width: 380px;
border-color: #ddd;
.toggle-triangle-icon {
path.svg__fill--accent-blue {
fill: $accent-blue;
Expand All @@ -26,6 +27,9 @@
margin: auto;
padding: 24px 30px 30px 30px;
width: 100%; // filters dropdown grows to container width
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
border-radius: 0px 0px 10px 10px;
border: none;
}

// Filter Heading
Expand Down Expand Up @@ -123,4 +127,17 @@
}
}
}

@media #{$small} {
:deep(.mobile-button) {
width: 166px;
min-width: unset;
padding: 6px;
// border: none;
.button-inner-wrapper {
flex-direction: row-reverse;
justify-content: center;
}
}
}
}
12 changes: 7 additions & 5 deletions src/styles/default/_mobile-drawer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@
}

@media #{$has-hover} {
.mobile-button:hover {
background-color: #f1f1f1;
}
@media #{$small} {
.mobile-button:hover {
background-color: #f1f1f1;
}

.svg__icon-close.svg-glyph-close:hover {
cursor: pointer;
.svg__icon-close.svg-glyph-close:hover {
cursor: pointer;
}
}
}

Expand Down
37 changes: 36 additions & 1 deletion src/styles/ftva/_filters-dropdown.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
.ftva.filters-dropdown {
:deep(.mobile-button) {
border-color: #ddd;
&:hover, &:focus {
border-color: #ddd;
}
&:hover {
background-color: #f1f1f1;
}
}
// Done / Clear Buttons
.action-row {
.action-row-button {
color: $accent-blue;
Expand Down Expand Up @@ -31,12 +41,37 @@
color: white;
}
}
:deep(.svg__icon-close) {
.icon-close {
path {
stroke: white;
}
circle {
fill: transparent;
}
}

@media #{$small} {
// Input field / Button on Mobile
:deep(.mobile-button) {
border-color: $medium-grey;
&:hover, &:focus {
border-color: $medium-grey;
}
&.is-expanded {
color: $accent-blue;
border: 2px solid $accent-blue;

path.svg__fill--accent-blue {
fill: $accent-blue;
}
}
}
.icon-svg {
:deep(svg) {
path.svg__fill--accent-blue {
fill: $medium-grey;
}
}
}
}
}

1 comment on commit cee21bd

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.