Socket
Book a DemoInstallSign in
Socket

ndla-ui

Package Overview
Dependencies
Maintainers
6
Versions
230
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ndla-ui

UI component library for NDLA.

latest
Source
npmnpm
Version
0.17.12
Version published
Weekly downloads
31
47.62%
Maintainers
6
Weekly downloads
 
Created
Source

ndla-ui

Main UI component library for NDLA.

Installation

$ yarn add --save ndla-ui
$ npm i --save ndla-ui

Optional dependencies

The following dependencies are optional, but some components may be dependent on one or more of them.

react-collapse
react-height
react-motion
react-router
ndla-article-scripts
ndla-button
ndla-licenses
ndla-icons
ndla-tabs
ndla-util

See: package.json for version requirements

N.B! All optional dependencies are required if you use import {...} from 'ndla-ui'

Usage

Styling

/* Your project's main .scss import file */
@import '~ndla-ui/scss/main'; // with webpack and sass-loader
@import '../path/to/node_modules/ndla-ui/scss/main'; // direct reference

Simplified example

import { Hero, OneColumn, Article, Breadcrumb } from 'ndla-ui';

const MyPage = ({ topicPath, topic, article }) => {
  return (
    <div>
      <Hero>
        <OneColumn cssModifier="narrow">
          <div className="c-hero__content">
            <section>
              <Breadcrumb topicPath={topicPath} />
              <h1 className="c-hero__title">{topic.name}</h1>
            </section>
          </div>
        </OneColumn>
      </Hero>
      <div className="u-bg-lightblue">
        <OneColumn cssModifier="narrow">
          <Article article={article} />
        </OneColumn>
      </div>
    </div>
  );
};

Only import specific components

import Hero from 'ndla-ui/es/hero/Hero';

const MyPage = () => {
  return (
    <Hero>
      <MyAwesomeComponent />
    </Hero>
  );
};

Keywords

styleguide

FAQs

Package last updated on 02 Nov 2018

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