Skip to content

Conversation

@Sveb
Copy link
Collaborator

@Sveb Sveb commented Oct 21, 2025

Component Created: YearRangeFilter.vue

Stories: ~/stories/YearRangeFilter.stories.js

Spec: ~/stories/YearRangeFilter.spec.js

Notes:

Screenshot 2025-10-21 at 12 50 09

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:

  • I checked that it is working locally in the dev server
  • I checked that it is working locally in the storybook
  • I checked that it is working locally in the
    library-website-nuxt dev server
  • I added a screenshot of it working
  • UX has reviewed and approved this
  • I assigned this PR to someone on the dev team to review
  • I used a conventional commit message
  • I assigned myself to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Oct 22, 2025

@github-actions github-actions bot temporarily deployed to storybook--pull_request_target-844 October 22, 2025 19:21 Inactive
@github-actions github-actions bot temporarily deployed to storybook--pull_request_target-844 October 27, 2025 21:14 Inactive

// Handle limit button click
function handleLimitClick() {
emit('change', { min: localMinValue.value, max: localMaxValue.value })
Copy link
Contributor

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>()
Copy link
Contributor

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.

@github-actions github-actions bot temporarily deployed to storybook--pull_request_target-844 October 29, 2025 19:19 Inactive
<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>
Copy link
Contributor

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,
@Sveb Sveb temporarily deployed to netlify-preview October 30, 2025 10:36 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook--pull_request_target-844 October 30, 2025 20:17 Inactive
@@ -0,0 +1,11 @@
Designs:
Copy link
Contributor

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 }
Copy link
Contributor

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>
Copy link
Contributor

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>

Copy link
Contributor

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

Copy link
Contributor

@pghorpade pghorpade left a comment

Choose a reason for hiding this comment

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

👍

@pghorpade pghorpade merged commit 0d1c1f4 into UCLALibrary:main Nov 3, 2025
14 checks passed
@pghorpade
Copy link
Contributor

🎉 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 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants