npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@volvo-cars/site-nav-component

v3.1.3

Published

High level site navigation component on volvocars.com

Downloads

25

Readme

Site Navigation for volvocars.com

@volvo-cars/site-nav-component @volvo-cars/site-nav-component

This is the global navigation component that can be found on volvocars.com

Install

Install the package:

npm install @volvo-cars/site-nav-component
# or
yarn add @volvo-cars/site-nav-component

Requirements

Styling and theming is handled with VCC UI:

  1. npm install vcc-ui
  2. Wrap your application in a <StyleProvider> and <ThemeProvider>
  3. Configure at least the following static assets for VCC UI (example configuration):
    • The "Volvo Logo"
    • The "Volvo Novum Light", "Volvo Novum Regular" and "Volvo Broad" fonts

Browser support and polyfills

The code is compiled to match @volvo-cars/browserslist-config but you also need to include some runtime polyfills to support old browsers. We recommend the @volvo-cars/polyfill package.

If you have given a sub navigation (through the children prop), we will measure it once at component mount to determine the height the site nav should occupy. We use ResizeObserver to re-measure the sub navigation, so if you have a sub navigation that will hide or resize you should add a ResizeObserver polyfill.

Usage

The data and content are not provided in this package. You will need to fetch content from the VCC Content Delivery API. Please contact Content Delivery API team for more information.

import { SiteNav } from "@volvo-cars/site-nav-component"

const myApp() (
  ...
  <SiteNav
    data={dataFromContentDeliveryAPI}
  />
  ...
)

Props

| Props | Type | Description | Required | Default | | ----------------------- | ---------------------- | --------------------------------------------------------------------------------- | -------- | ------------ | | data | SiteNavPayload | Data from VCC Content Delivery API | ✔︎ | null | | userMenuData | UserMenuPayload | Data for the user menu | | null | | children | jsx | Child nodes (sub navigation) to stick beneath the footer | | null | | enableMaxWidth | boolean | Enable max width for menu (1440px) | | false | | hideOnScroll | boolean | Hide navigation when scrolling down, enabled by default if given children prop | | !!children | | hideOnScrollOffsetTop | number | The amount of pixels that needs to be scrolled to hide the header, defaults to 80 | | 80 |

User Menu Data

The data for user menu is also not provided in this package. You will need to fetch the data from the My Volvo API. the production endpoints are like this: https://www.volvocars.com/data/dynamic/myvolvo/menu?sc_site=${marketCode}

Embedded Search

Embedded Search should work out of the box, but since it is using fetch to get the search suggestions, your application might need to pollyfill fetch to support older browsers (i.e. IE 11). We use isomorphic-unfetch npm package.

Tracking

<SiteNav> component is doing click tracking if you set up Google Tag Manager (GTM) properly on your page. If you don't have GTM it should silently ignore and work as usual.

We highly recommend you to enable tracking. It will allow us to have a better understating of the actual usage of the component and improve it based on the data we gather.

Please contact the analytics team in order to set up the Google Tag Manager.

Bug Report

Please report any issues and bugs to the Web Impressions board in JIRA.

Changelog

See our CHANGELOG

Support

If you have any questions or need help using this component please shout out on the ced-wi-general (Web Impressions) slack channel.