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

@bbc/psammead-brand

v7.3.18

Published

Provides the BBC News logo (as SVG), nested a hardcoded link to https://www.bbc.co.uk/news

Downloads

709

Readme

psammead-brand - Known Vulnerabilities Dependency Status peerDependencies Status Storybook GitHub license npm version PRs Welcome

Description

The Brand component provides the BBC service logo (as SVG), nested inside a styled link and div. The link is currently hardcoded to "https://www.bbc.co.uk/news".

Brand takes a product, svgHeight, minWidth, maxWidth, url, serviceLocalisedName, backgroundColour, logoColour and svg as props.

The product is passed to a VisuallyHiddenText component, nested inside Brand.

The serviceLocalisedName is an optional prop referring to the local name of a service eg Yoruba. It is also passed to VisuallyHiddenText inside the Brand component.

The svg prop must contain a group, viewbox values and a ratio, which is used within an svg element. Examples of the svg object can be found in @bbc/psammead-assets.

The minWidth and maxWidth values are required to allow the ability for the svg element to dynamically scale as the viewport becomes a very small size EG: feature phones.

The svgHeight value acts as a placeholder for the svg element meaning the overall banner height does not change with the dynamic scaling, also the height allows the contents of the svg element to remain vertically centred within the banner at all times.

The backgroundColour is the background colour and logoColour is the colour of the SVG and the underline when hovering/focusing on the brand.

The url value is the link that points to the frontpage of the service associated with the svg.

The scriptLink can be used to render ScriptLink component which is a link to the service variant.

Exports

/skip-link - Use the skip link component to help keyboard-only users skip to the main content on the page.

Installation

npm install @bbc/psammead-brand

Props

| Argument | Type | Required | Default | Example | | --------- | ------ | -------- | ------- | ------------ | | product | String | yes | N/A | 'BBC News' | | svgHeight | Number | yes | N/A | 24 | | minWidth | Number | yes | N/A | 240 | | maxWidth | Number | yes | N/A | 380 | | svg | Object | yes | N/A | { group: (<g fillrule="evenodd"><path d="M84.32" /></g>), viewbox: { height: 24, width: 167.95 }, ratio: 6.9979 } | | backgroundColour | String | yes | N/A | ${C_POSTBOX} or relevant string hex code | | logoColour | String | yes | N/A | ${C_WHITE} or relevant string hex code | | url | String | no | N/A | https://www.bbc.co.uk/news | | serviceLocalisedName | String | no | N/A | 'Yoruba' | | borderTop | Boolean | no | false | true | | borderBottom | Boolean | no | false | true | | scriptLink | Node | no | null | <ScriptLink service='news' script={latin} href='https://www.bbc.com/serbian/lat'> Lat </ScriptLink> | | skipLink | Node | no | null | <SkipLink service='news' script={latin} href='#content'> Skip to content </SkipLink> | | linkId | String | no | null | 'brandLink' |

Usage

The typical use-case of this component is at the top of pages in a header element. When this is done it is recommend that the component is wrapped in a banner role. However, a header with a banner role should only appear once on a page.

When using Brand in the header, you should ensure that borderBottom prop is set to true. Similarly, when using brand on the footer you should set borderTop to true. This ensures when in High Contrast Mode on PC and when the user changes colour preferences in FireFox that the top/bottom of the Brand component is visible.

ScriptLink component should be passed to scriptLink only when linking to a service variant.

import Brand from '@bbc/psammead-brand';
import SkipLink from '@bbc/psammead-brand/skip-link';
import { igbo } from '@bbc/psammead-assets/svgs';
import ScriptLink from '@bbc/psammead-script-link';
import { C_POSTBOX, C_WHITE } from '@bbc/psammead-styles/colours';
import { latin } from '@bbc/gel-foundations/scripts';

const scriptLink = (
  <ScriptLink
    service="news"
    script={latin}
    href="https://www.bbc.com/serbian/lat"
  >
    Lat
  </ScriptLink>
);

const skipLink = (
  <SkipLink service="news" script={latin} href="#content">
    Skip to content
  </SkipLink>
);

const Header = (product, serviceName) => (
  <header role="banner">
    <Brand
      product={product}
      serviceLocalisedName={serviceName}
      svgHeight={24}
      maxWidth={280}
      minWidth={180}
      svg={igbo}
      url="https://www.bbc.co.uk/news"
      backgroundColour={backgroundColour}
      logoColour={logoColour}
      borderBottom
      scriptLink={scriptLink}
      skipLink={skipLink}
    />
  </header>
);

When to use this component

The Brand component is designed to be used where a BBC logo is required as SVG. Brand is used in the BrandContainer, which consumes a service context it passes to the Brand.

Accessibility notes

  • Visually hidden text is provided (e.g. for screen reader users)
  • Brand is keyboard-accessible and provides hover and focus styles
  • The brand SVG has support for users with css disabled or high contrast mode enabled.

Additional notes

  • width: 100% is needed on both <a> and the <svg> to allow the brand to dynamically scale on the Firefox browser

Contributing

Psammead is completely open source. We are grateful for any contributions, whether they be new components, bug fixes or general improvements. Please see our primary contributing guide which can be found at the root of the Psammead respository.

Code of Conduct

We welcome feedback and help on this work. By participating in this project, you agree to abide by the code of conduct. Please take a moment to read it.

License

Psammead is Apache 2.0 licensed.