-
Notifications
You must be signed in to change notification settings - Fork 5
feat: create YearRangeFilter component #844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- marks footer as already existing
|
|
||
| // Handle limit button click | ||
| function handleLimitClick() { | ||
| emit('change', { min: localMinValue.value, max: localMaxValue.value }) |
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.
Router integration on “Limit”
- Use useRoute() + useRouter() and push a new query while preserving existing ones.
- Avoid clobbering other query params; just set year_gte / year_lte (or names you pass via props).
- Optionally clear pagination (page) when filters change.
| step: number | ||
| disabled: boolean | ||
| } | ||
| const props = defineProps<YearRangeFilterProps>() |
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.
Configurable query param names
- Add optional props like minParam / maxParam so this component stays reusable across pages.
| <YearRangeFilter v-bind="args" /> | ||
| <div style="margin-top: 20px; padding: 10px; background: #f5f5f5; border-radius: 4px;"> | ||
| <h4 style="margin: 0 0 10px 0;">Mock Query Parameters:</h4> | ||
| <pre style="margin: 0; font-size: 12px;">{{ JSON.stringify(mockQuery, null, 2) }}</pre> |
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.
what should this output?
…via the arrow inputs - adjusts the spec.js file - adjusts the component and its css to make room for the min/max slider handles when they are very close next to each other,
| @@ -0,0 +1,11 @@ | |||
| Designs: | |||
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.
Remove this file
| }, | ||
| setup() { | ||
| // Mock router for Storybook demonstration | ||
| return { args } |
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.
// reactively read the router query
const currentQuery = computed(() => router.currentRoute.value.query)
// make a canonical querystring to display (sorted for stability)
const queryString = computed(() => {
const params = new URLSearchParams()
// sort keys for consistent output
const entries = Object.entries(currentQuery.value).sort(([a], [b]) => a.localeCompare(b))
for (const [key, val] of entries) {
if (Array.isArray(val)) {
for (const v of val) params.append(key, String(v))
} else if (val != null) {
params.set(key, String(val))
}
}
const s = params.toString()
return s ? `?${s}` : ''
})
return { args, currentQuery, queryString }
| template: ` | ||
| <div style="width: 280px;"> | ||
| <YearRangeFilter v-bind="args" /> | ||
| </div> |
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.
<!-- Debug panel that updates the moment the Limit button pushes to router -->
<div style="font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; border: 1px solid #eee; border-radius: 8px; padding: 8px;">
<div style="margin-bottom: 6px;"><strong>Router querystring</strong></div>
<div style="padding: 6px 8px; background: #fafafa; border-radius: 6px; overflow:auto;">
{{ queryString }}
</div>
<div style="margin: 8px 0 6px;"><strong>Router query (JSON)</strong></div>
<pre style="margin: 0; white-space: pre-wrap;">{{ currentQuery }}</pre>
</div>
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.
try these changes and see if we can output the router querychanges
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.
👍
# [@ucla-library-monorepo/ucla-library-website-components-v1.42.0](https://github.com/UCLALibrary/ucla-library-website-components/compare/@ucla-library-monorepo/ucla-library-website-components-v1.41.3...@ucla-library-monorepo/ucla-library-website-components-v1.42.0) (2025-11-03) ### Features * create YearRangeFilter component ([#844](#844)) ([0d1c1f4](0d1c1f4))
|
🎉 This PR is included in version @ucla-library-monorepo/ucla-library-website-components-v1.42.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Component Created: YearRangeFilter.vue
Stories: ~/stories/YearRangeFilter.stories.js
Spec: ~/stories/YearRangeFilter.spec.js
Notes:
Designs: https://www.figma.com/design/CDhWDARLb36ftkQce1LyLC/Breakpoints?node-id=1-25&m=dev
https://www.figma.com/design/CDhWDARLb36ftkQce1LyLC/Breakpoints?node-id=1-26&p=f&m=dev
Read in Recording: https://drive.google.com/file/d/17tiGmE4aax-faoo5Rjue2Idbx3OGCFGa/view?usp=sharing
Relevant Links https://www.library.ucla.edu/ https://digital.library.ucla.edu/catalog/ark:/21198/z1x98m6j
Checklist:
library-website-nuxt dev server