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

@carforyou/header-footer

v10.0.3

Published

CAR FOR YOU Header / Footer

Downloads

9

Readme

CAR FOR YOU Header / Footer

Deployment semantic-release

Usage

npm install @carforyou/header-footer

In your postcss config, add the components paths to the purgecss paths, so this packages classnames don't get stripped:

const glob = require("glob")
glob.sync("node_modules/@carforyou/header-footer/pkg/**/*.js")

Make sure to import global styles:

@import '@carforyou/components/assets/index.css';

Translations will be handled by the application, so you'll need to make sure the dictionaries are passed to the i18n setup properly:

import de from "@carforyou/header-footer/locales/de.json"
import fr from "@carforyou/header-footer/locales/fr.json"
import it from "@carforyou/header-footer/locales/it.json"
import en from "@carforyou/header-footer/locales/en.json"

Use the components as follows, passing the language, the translation function and the root urls as the bare minimum:

import { Header } from "@carforyou/header-footer"

<Header
  language="de"
  t={t}
  dealerhubRootUrl="https://dealerhub.carforyou.ch"
  listingsRootUrl="https://www.carforyou.ch"
/>

Features

Header-Footer package supports enabling/disabling features via an optional features prop. To enable specific feature pass { <featureName>: true } e.g to disable the list for free CTA:

<Header
  language="de"
  dealerhubRootUrl="https://dealerhub.carforyou.ch"
  listingsRootUrl="https://www.carforyou.ch"
  features={{
    disabledCTA: true
  }}
/>

Existing features | Name | Affected component | Effect | |------|--------------------|--------| | disabledCTA | Header | disables List for free header CTA | showLeasingDisclaimer | Footer | shows a disclaimer with leasing information | showLoanDisclaimer | Footer | shows a disclaimer with loan information

Injecting mobile menu

In some cases, there is an additional menu/navigation component (like a sidebar) that needs to be merged with the mobile menu. To achieve that, we support mobileMenuElements prop, which can be used to inject some extra navigation. Usage example:

<Header
  language="de"
  mobileMenuElements={[
    {
      tag: "title",
      title: "Section Title",
    },
    {
      tag: "item",
      title: "Menu Item",
      IconComponent: Icon,
      onClick: trackingFunction,
      url: "http://menu-item.com",
    },
  ]}
/>

Injecting header icons

Sometimes an application might want to show additional icon in the header (think comparison tool, which is only applicable in listings). To support that we provide extraIcons optional prop that can be used like this:

<Header
  language="de"
  extraIcons={[
    <ComparisonIcon />
  ]}
/>

Development

npm run build

Whenever you change the json translation files, run

npm run build:translations

You can link your local npm package to integrate it with any local project:

cd carforyou-header-footer-pkg
npm run build

cd carforyou-listings-web
npm link ../carforyou-header-footer-pkg

If this throws an Invalid hook call error when integrating with a next.js project, add the following to the webpack config:

config.resolve.alias["react"] = path.resolve(__dirname, "node_modules", "react")
config.resolve.alias["react-dom"] = path.resolve(__dirname, "node_modules", "react-dom")

Release a new version

New versions are released on the ci using semantic-release as soon as you merge into master. Please make sure your merge commit message adheres to the corresponding conventions.

Circle CI

You will need to enable the repository in circle CI ui to be able to build it.

For slack notifications to work you will need to provide the token in circle settings.