Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@volvo-cars/ced-os-react-components

Package Overview
Dependencies
Maintainers
9
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@volvo-cars/ced-os-react-components

Set of components for developing UIs in the onboarding and support apps

  • 1.0.0-alpha.7
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
994
increased by36.73%
Maintainers
9
Weekly downloads
 
Created
Source

Support Web Components

This a component library based on vcc-ui created to standardize the creation and articulation of support article data provided via an API in JSON. Meaning when the new API provides content in JSON, it will have a structure that maps to these components. That way the data from the backend will dictate the structure and not the actual components. Although all components can and should be used where suitable also in other contexts.

The components can be viewed in this Storybook

The component are organized based on the Atomic design principles by Brad Frost.

Development

Getting Started

  • npm install
  • npm run dev to run storybook
  • npm test to run tests

Publish

The library is automatically published to Github packages and NPM when a new tag in the format v.X.X.X is pushed to Github.

The steps to publish are:

  1. build: npm run build
  2. bump version. Use npm version <major>.<minor>.<patch> to bump version

Usage

The library is published as an NPM package and also a Github package.

Install from NPM package registry

Run npm install @volvo-cars/ced-os-react-components.

Install from Github package registry

To be able to install the package from the Github registry some configuration and Github authentication is needed.

Add a file called .npmrc to your project and paste the lines below into it to configure NPM to load @volvo-cars packages from the Github registry. The second line references an environment variable on your machine: VCC_GITHUB_PACKAGES_TOKEN.

@volvo-cars:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${VCC_GITHUB_PACKAGES_TOKEN}

The value of VCC_GITHUB_PACKAGES_TOKEN should be a Github Personal Access token with at least "read:packages" permissions.

If you use the dotenv package in your project it's also possible to define the variable in the .env file. In which case you need to do dotenv npm install

Example usage

JSONArticle

The main entrypoint

// ...
import { JSONArticle } from '@volvo-cars/ced-os-react-components';

const Article = ({ articleId, content }) => {
    return (
        <View paddingTop={[3, 6]} paddingBottom={[3, 6]}>
            <JSONArticle data-article-id={articleId} data={content} />
        </View>
);
};
Standalone

If you want to use the renderer without creating a full JS project, with NPM etc, you can use the standalone solution. Include the standalone files under lib, and in the HTML template file, make sure to make the following replacements:

  • article: null must be replaced with article: '<article>', where article is the (JSON representation) of an article. It must contain an externalId. It must also contain the content of the document, i.e. a title and optionally also a description and body. These fields may be directly on the article object itself, or nested inside of article.content or article.jsonContent.
  • articleLinkClicked: null may be replaced with articleLinkClicked: function(articleId, targetId) { ... }, where the function will be called whenever the user clicks a link to another article. The function takes two arguments: the ID of the article being linked to, as well as (optionally) the ID of the target element (will typically just be null). If articleLinkClicked is left as null, it will default to working as a normal link, such that if the current URL is foo/bar/articleId1, and the user clicks a link to an article with ID articleId2, it will navigate to foo/bar/articleId2 (or foo/bar/articleId2#targetId, if targetId is not null).
  • linkClicked: null may be replaced with linkClicked: function(href) { ... }, where the function will be called whenever the user clicks on an external link. The function takes one argument: the URL of the link target. If linkClicked is left as null, it will default to simply navigating to the link.

FAQs

Package last updated on 22 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc