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

gh-action-test

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gh-action-test

Design system for Digital NSW

  • 2.3.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
1
Weekly downloads
 
Created
Source

NSW Design System

npm version

NSW Design system is a collection of reusable UI components used on the NSW government websites.

See live examples of NSW Digital Design system components and guidance on how to use them on you website at NSW Design System.

Using the design system

How you use the NSW Design System depends on your team's capabilities. We recommend using npm but also provided in a CDN, and a downloadable starter kit which includes all the compiled assets.

  1. Installing with NPM
  2. Using JSDelivr CDN
  3. Download starter kit

Installing with NPM

npm is a package manager for Node-based projects. We recommend npm packages because it makes it easy to update and install the design system from the command line.

  1. Install Node/npm.

  2. Generate a package.json file using the npm init command in the terminal. You will be prompted to enter several pieces of information, like the name of your application, version, description etc.

  3. Add nsw-design-system to your project’s package.json:

    • npm install --save nsw-design-system

The NSW Design System is now installed as a dependancy of your project, check out how to import styles and javascript in to your project build.

Importing styles into your project

The NSW Design System styles need to be added to the main Sass file in your project.
Use the below snippet to import the NSW Design System (ideally placed before any other imports or sass):

@import 'node_modules/nsw-design-system/src/main';
Adding the font

In your main html document add this line of code inside the <head> tag

  <link href="https://fonts.googleapis.com/css?family=Montserrat:400,600&display=swap" rel="stylesheet">
Using the icons

The design system icons use sprite SVG, add this line of code inside the <head> tag in your main html document

  <script>
    // SVG Sprite Loader
    var svgAjax = new XMLHttpRequest();
    svgAjax.open("GET", "https://cdn.jsdelivr.net/npm/nsw-design-system/dist/assets/svg/sprite.svg", true);
    svgAjax.send();
    svgAjax.onload = function(e) {
      var fragment = document.createRange().createContextualFragment(svgAjax.responseText);
      var svg = fragment.querySelector('svg')
      svg.setAttribute('aria-hidden', true);
      svg.style.cssText = 'position: absolute; width: 0; height: 0; overflow: hidden;'
      document.body.insertBefore(fragment, document.body.childNodes[0]);
    };
  </script>

Importing javascript into your project

Some of the NSW Design System components require javascript to provide advanced functionality. To ensure the page is ready for javascript to run, include the follow scripts tags at the end of the html document.

    <script src="node_modules/nsw-design-system/src/main.js"></script>
    <script>window.NSW.initSite()</script>
  </body>
</html>

Depending on your project set up, you might wish to copy the file into your project from node_modules or add the reference to your build workflow.

Using JSDelivr CDN

The bundled css and js files are also hosted in JSDelivr.

You can add the files to your main html document

<html>
  <head>
    ...
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nsw-design-system@2/dist/css/main.css">
  </head>
  <body>
    ...
    <script src="https://cdn.jsdelivr.net/npm/nsw-design-system@2/dist/js/main.min.js"></script>
    <script>window.NSW.initSite()</script>
  </body>
</html>

Download starter kit

You can download the compiled design system assets (HTML, CSS, JavaScript) in the HTMLStarterkit zip file from the latest release.

Getting updates

To be notified when there’s a new release, you can either join the NSW Design System community or watch the NSW Design System Github

Keywords

FAQs

Package last updated on 17 Nov 2020

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