Skip to content

Conversation

@lux-v
Copy link

@lux-v lux-v commented Aug 21, 2025

Component Created: BlockAnchorNav & PanelAnchorNav.vue

Stories: ~/stories/BlockAnchorNav & PanelAnchorNav.stories.js

Spec: ~/stories/BlockAnchorNav & PanelAnchorNav.spec.js

Notes:
image
image

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

@lux-v lux-v requested a review from Copilot August 21, 2025 16:34
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces two new navigation components - BlockAnchorNav and PanelAnchorNav - along with a reusable Button component. The changes include proper TypeScript types, comprehensive Storybook stories with edge case testing, and updates to design tokens for DLC (Digital Library Collections) support.

Key changes:

  • Created BlockAnchorNav component for inline anchor navigation with sanitization
  • Created PanelAnchorNav component for slide-out panel navigation with scroll detection
  • Added Button component with primary/secondary variants and multiple color options

Reviewed Changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/vue-component-library/src/lib-components/BlockAnchorNav.vue Main anchor navigation component with input sanitization and validation
packages/vue-component-library/src/lib-components/PanelAnchorNav.vue Slide-out panel wrapper for BlockAnchorNav with scroll behavior
packages/vue-component-library/src/lib-components/Button.vue Reusable button component with TypeScript types and variant support
packages/vue-component-library/src/types/components/blockAnchorNav.types.ts TypeScript interfaces for BlockAnchorNav props
packages/vue-component-library/src/types/components/button.types.ts TypeScript enums and interfaces for Button component
packages/vue-component-library/src/styles/default/_*.scss SCSS styling for all three components
packages/vue-component-library/src/stories/*.stories.js Comprehensive Storybook stories including edge cases
packages/vue-component-library/vite.config.ts Added DLC design token imports
packages/vue-component-library/package.json Updated design tokens version
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

// Allow only safe protocols
const SAFE_PROTOCOLS = ['http:', 'https:', 'mailto:', 'tel:']
try {
const url = new URL(to, 'http://dummy.base') // base needed for relative URLs
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

Using a dummy base URL could potentially mask malicious URLs. Consider using window.location.origin or a more explicit validation approach instead of a dummy base.

Suggested change
const url = new URL(to, 'http://dummy.base') // base needed for relative URLs
const url = new URL(to, window.location.origin) // base needed for relative URLs

Copilot uses AI. Check for mistakes.
// Scroll detection
function handleScroll() {
if (!props.showOpenIconAlways) {
// Show open icon after scrolling 50% of the viewport height
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

The comment mentions 'after scrolling 50% of the viewport height' but the code calculates 50% (0.5), which contradicts the earlier comment about '100vh'. Consider updating the comment to be consistent.

Suggested change
// Show open icon after scrolling 50% of the viewport height
// Show open icon after scrolling at least 50% of the viewport height

Copilot uses AI. Check for mistakes.
width: 37.5px;
height: 37.5px;

transform: translateX(100vw);
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

[nitpick] The transform value translateX(100vw) is inconsistent with other transform values in the file that use percentages. Consider using translateX(100%) for consistency.

Suggested change
transform: translateX(100vw);
transform: translateX(100%);

Copilot uses AI. Check for mistakes.

output.push({ label, to })
}
return output
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

[nitpick] Consider using Array.filter() and Array.map() instead of a manual for loop for better functional programming style and readability.

Suggested change
return output
return props.items
.filter((raw: any) => {
const label = typeof raw?.label === 'string' ? raw.label.trim() : '';
const to = typeof raw?.to === 'string' ? raw.to.trim() : '';
return label && to && isRouteLike(to);
})
.map((raw: any) => ({
label: typeof raw?.label === 'string' ? raw.label.trim() : '',
to: typeof raw?.to === 'string' ? raw.to.trim() : '',
}));

Copilot uses AI. Check for mistakes.

// Add CSS for real page scenario
const style = document.createElement('style')
style.textContent = `
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

Adding styles directly to the document head in a story file could cause side effects between stories. Consider using Storybook's decorator pattern or CSS-in-JS approach instead.

Suggested change
style.textContent = `
RealPageWithManySections.decorators = [withRealPageStyle]
// Decorator to inject and clean up styles for the real page scenario
const realPageStyle = `

Copilot uses AI. Check for mistakes.
@netlify
Copy link

netlify bot commented Sep 3, 2025

Deploy Preview for ucla-components-storybook ready!

Name Link
🔨 Latest commit a3894c6
🔍 Latest deploy log https://app.netlify.com/projects/ucla-components-storybook/deploys/68bee3fdcd446e00088c0a1b
😎 Deploy Preview https://deploy-preview-29--ucla-components-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant