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

dha-assets

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dha-assets

DHA SDK assets

  • 1.0.1
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by60%
Maintainers
1
Weekly downloads
 
Created
Source

dha-assets

This module is used for background image and audio assets.

How to use

Installing the module

Use the following command to install from npm:

  • npm install dha-assets
Importing the module

Once you have the module installed you can import the exported components/modules into your code like so:

import Background, { audioFiles, createAudio, pauseAudio, playAudio, stopAudio } from 'dha-assets';
Using the module

Example of using Background component:

<Background
  image="dha.png"
  alt="DHA logo"
  scale={1}
  styles={{ maxWidth: '500px', position: 'static', zIndex: '0' }}
/>

<Background
  image="dha.png"
  alt="DHA logo"
  scale={1}
  styles={{ maxWidth: '500px', position: 'static', zIndex: '0' }}
>
  <p>Add nested div or React component</p>
</Background>
  • image: Background image full path and file
  • alt: Alternate text
  • scale: Image scale with transform
  • styles: Custom css styles

Example of using audio module:

componentDidMount() {
  createAudio('example', 'http://www.example.com/audio/example.mp3');
}

play = () => {
  playAudio('example');
};

pause = () => {
  pauseAudio('example');
};

stop = () => {
  stopAudio('example');
};
Testing
  • Tests can be ran with the npm test command.
  • Tests are ran using Jest with Enzyme - More information about getting started with Jest can be found here.

Example render test:

test('renders without crashing', () => {
  shallow(<Background image="image.jpg" alt="Image" scale={2} styles={{ height: '50%' }} />);
});

How to contribute

Setting up the module
Building the module

The module uses Typescript compiler (TSC) to compile the source code. To build the project run the following command:

  • npm run build
Installing the module in app for testing

You can install the module into your own React project as a dependency. After you clone the module you can install using the following command:

  • npm install /absolute/path/to/dha-assets
  • i.e. -> npm install /Users/dha/Documents/projects/npm/dha-assets

Viewing API docs

You can generate and view the API docs by running the following commands:

  • npm run styleguide:build
  • npm run typedocs

This will start a development server on localhost:6060 showing all the properties for the Background component.

You can also view the docs which are hosted here:

Audio: https://dhasdk.bitbucket.io/TypescriptModules/docs/dha-assets/docs

Background: https://dhasdk.bitbucket.io/ReactModules/docs/#/Background

Viewing source code

https://bitbucket.org/wmtp/dha-assets

Published module

Here is where the module is currently published:

https://www.npmjs.com/package/dha-assets

License

This project is licensed under the MIT License.

FAQs

Package last updated on 10 Apr 2019

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