-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: APPS-2516 Add block remove search filter to vue3 branch (#437)
* update to vue3 and afix the colorway functionality * fix outline on button and updtae README with connection to Nuxt directions git push origin APPS-2516_add-block-remove-search-filter-to-vue3-branch_1-24-24 * update stories * run auto-fix on linter * delete changes to the README * update focus area to the entire button * fix linting errors
- Loading branch information
1 parent
4c0b500
commit e49377b
Showing
6 changed files
with
231 additions
and
8 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 |
---|---|---|
|
@@ -33,3 +33,4 @@ cypress/e2e/2-advanced-examples | |
serve | ||
vite.config.serve.ts | ||
src/App.vue | ||
src/mock.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
<script setup> | ||
// Helpers | ||
import { computed } from 'vue' | ||
import { useRoute } from 'vue-router' | ||
import SvgGlyphClose from 'ucla-library-design-tokens/assets/svgs/icon-close.svg' | ||
import getSectionName from '@/utils/getSectionName' | ||
const props = defineProps({ | ||
title: { | ||
type: String, | ||
default: '', | ||
}, | ||
filterType: { | ||
type: String, | ||
default: '', | ||
}, | ||
index: { | ||
type: Number, | ||
default: 0, | ||
}, | ||
color: { | ||
type: String, | ||
default: '', // This will be "visit", "about", "help". | ||
}, | ||
},) | ||
const emit = defineEmits(['removeBlockFilter']) | ||
const route = useRoute() | ||
const sectionName = computed(() => { | ||
return ( | ||
props.color | ||
|| (route.path | ||
? getSectionName(route.path) | ||
: 'color-default') | ||
) | ||
}) | ||
const classes = computed(() => { | ||
return ['block-remove-search-filter', `color-${sectionName.value}`] | ||
}) | ||
function closeBlockFilter() { | ||
emit('removeBlockFilter', props.index) | ||
} | ||
</script> | ||
|
||
<template> | ||
<button type="button" :class="classes" @click="closeBlockFilter"> | ||
<span class="title">{{ title }}</span> | ||
|
||
<span class="button-close"> | ||
<SvgGlyphClose class="svg-glyph-close" /> | ||
</span> | ||
</button> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
.block-remove-search-filter { | ||
padding: 12px; | ||
display: flex; | ||
flex-direction: row; | ||
border: 1.5px var(--color-border) solid; | ||
background-color: #ffffff; | ||
border-radius: 4px; | ||
align-items: center; | ||
width: fit-content; | ||
font-weight: 400; | ||
font-size: 18px; | ||
line-height: 100%; | ||
.title { | ||
margin-right: 8px; | ||
color: #032d5b; | ||
} | ||
&.color-default { | ||
--color-border: var(--color-default-cyan-03); | ||
&:hover { | ||
background-color: transparentize(($default-cyan-03), 0.9); | ||
} | ||
} | ||
&.color-help { | ||
--color-border: var(--color-help-green-03); | ||
&:hover { | ||
background-color: transparentize(($help-green-03), 0.9); | ||
} | ||
} | ||
&.color-visit { | ||
--color-border: var(--color-visit-fushia-03); | ||
&:hover { | ||
background-color: transparentize(($visit-fushia-03), 0.9); | ||
} | ||
} | ||
&.color-about { | ||
--color-border: var(--color-about-purple-03); | ||
&:hover { | ||
background-color: transparentize(($about-purple-03), 0.9); | ||
} | ||
} | ||
} | ||
</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
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,10 @@ | ||
describe('SEARCH / Block Remove Search Filter', () => { | ||
it('Default', () => { | ||
cy.visit( | ||
'/iframe.html?id=search-block-remove-search-filter--default&args=&viewMode=story' | ||
) | ||
cy.get('.block-remove-search-filter').should('exist') | ||
|
||
cy.percySnapshot('SEARCH / Block Remove Search Filter: Default') | ||
}) | ||
}) |
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,100 @@ | ||
import BlockRemoveSearchFilter from '@/lib-components/BlockRemoveSearchFilter' | ||
|
||
export default { | ||
title: 'SEARCH / Block Remove Search Filter', | ||
component: BlockRemoveSearchFilter, | ||
} | ||
|
||
const mock = { | ||
title: ' Default Amenities', | ||
filterType: 'location || departments || subjects || categories', | ||
color: 'default', | ||
} | ||
|
||
// Variations of stories below | ||
export function Default() { | ||
return { | ||
data() { | ||
return { ...mock } | ||
}, | ||
components: { BlockRemoveSearchFilter }, | ||
template: ` | ||
<block-remove-search-filter | ||
:title="title" | ||
:color="color" | ||
/> | ||
`, | ||
} | ||
} | ||
|
||
export function Help() { | ||
return { | ||
data() { | ||
return { ...mock } | ||
}, | ||
components: { BlockRemoveSearchFilter }, | ||
template: ` | ||
<block-remove-search-filter | ||
title="Help" | ||
color="help" | ||
/> | ||
`, | ||
} | ||
} | ||
|
||
export function Visit() { | ||
return { | ||
data() { | ||
return { ...mock } | ||
}, | ||
components: { BlockRemoveSearchFilter }, | ||
template: ` | ||
<block-remove-search-filter | ||
title="Visit" | ||
color="visit" | ||
/> | ||
`, | ||
} | ||
} | ||
|
||
export function About() { | ||
return { | ||
data() { | ||
return { ...mock } | ||
}, | ||
components: { BlockRemoveSearchFilter }, | ||
template: ` | ||
<block-remove-search-filter | ||
title="About" | ||
color="about" | ||
/> | ||
`, | ||
} | ||
} | ||
|
||
export function FocusTest() { | ||
return { | ||
data() { | ||
return { ...mock } | ||
}, | ||
components: { BlockRemoveSearchFilter }, | ||
template: ` | ||
<block-remove-search-filter | ||
:title="title" | ||
:filterType="filterType" | ||
/><br> | ||
<block-remove-search-filter | ||
title="Help" | ||
color="help" | ||
/><br> | ||
<block-remove-search-filter | ||
title="Visit" | ||
color="visit" | ||
/><br> | ||
<block-remove-search-filter | ||
title="About" | ||
color="about" | ||
/> | ||
`, | ||
} | ||
} |
e49377b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Published on https://ucla-library-storybook-vue3x.netlify.app as production
🚀 Deployed on https://65b453e5b634202f8135aaff--ucla-library-storybook-vue3x.netlify.app
e49377b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 Deployed on https://deploy-preview--ucla-library-storybook-vue3x.netlify.app