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/sticky-nav-component

v0.0.6

Published

High level sticky navigation component on volvocars.com

Downloads

21

Readme

Sticky Navigation for volvocars.com

sticky-nav-github-example

Check out our Storybook for examples

Behavior

The <StickyNav /> component can show up to 5 given links. It has a breakpoint at 900px where it goes from desktop from/to tablet/mobile.

Desktop (900px and above)

On desktop all links will be accessible from the left or right side of the screen. The icons will always be visible and the nav will slide out on hover and reveal the links. There hover area is the visible element aswell as a 50px padding around them to make it more accessible.

Tablet / mobile (less than 900px)

On mobile they will attach to the bottom of the screen and hide/show on scroll up/down. On mobile it will show 3 - 5 links, depending on the width of the viewport. We suggest that the given links are in a prioritized order with the more important links first, as the last 2 links wont be visible on smaller screens.

Requirements

  • vcc-ui is a peer dependency
  • Your application should already have been wrapped in a <StyleProvider> and <ThemeProvider>

Install

Install the package:

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

Usage

NOTE: Data from the Content API is not yet available.

~~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 { StickyNav, StickyNavItem, StickyNavIcon } from "@volvo-cars/sticky-nav-component"

const myApp = () => (
  ...
  // Simple usage
  <StickyNav
    items={arrayOfLinkItems}
  />
  ...

  // Componentized usage
  <StickyNav>
    <StickyNavItem
      href="/chat"
      icon="chat"
    >
      Chat
    </StickyNavItem>
    ...
  </StickyNav>
  ...

  // Custom icon example
  <StickyNav>
    <StickyNavItem
      onClick={() => toggleChatFn()}
      icon={
        <>
          <StickyNavIcon type="chat" color="currentColor" />
          <MyCustomOverlayComponent />
        </>
      }
    >
      Chat
    </StickyNavItem>
    ...
  </StickyNav>
  ...
)

Props

<StickyNav>

The base component for the sticky navigation.

| Props | Type | Description | Required | Default | | ---------------- | --------------------- | ------------------------------------------------------------- | -------- | -------- | | items | StickyNavItems | Array of link objects, as an alternative to nested components | | [] | | zIndex | number | Can be overridden if default doesn't fit the solution | | 5000 | | fontSizePreset | string | Change font size by preset (small, normal, large) | | normal | | textTransform | string | Change text transform (none, uppercase, full-size-kana) | | none |

<StickyNavItem>

The <StickyNavItem> component is an anchor tag under the hood and takes the standard attributes like href, target, onClick, etc as well as the custom props below:

| Props | Type | Description | Required | Default | | ------ | ----------------- | ----------------------------------------------------------- | -------- | ------- | | icon | string or jsx | Either a string that refers to a default icon or custom JSX | | null |

<StickyNavIcon>

The <StickyNavIcon> has a set of available icons listen in the section below.

| Props | Type | Description | Required | Default | | ------- | -------- | ---------------------------------------------------- | -------- | -------------------------- | | type | string | See the list under "Icons" below for available icons | | question-mark (fallback) | | color | string | Color of the icon | | #000 |

Icons

Available icons for the links are the following:

  • build
  • chat
  • download-brochure
  • find-a-dealer
  • phone
  • question-mark
  • request-a-quote
  • request-an-offer
  • subscribe
  • test-drive

(See the Storybook for examples)

Tracking

<StickyNav> component is doing interaction 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.