Socket
Socket
Sign inDemoInstall

@ndla/audio-search

Package Overview
Dependencies
Maintainers
0
Versions
387
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ndla/audio-search

A simple library for searching for audio files from NDLA


Version published
Weekly downloads
527
decreased by-9.61%
Maintainers
0
Weekly downloads
 
Created
Source

A simple library for selecting NDLA audio files

Installation

yarn add @ndla/audio-search
npm install @ndla/audio-search

Usage

Styling

Get audio with the audio selector

To use the AudioSearch component, some functions for handling search and fetching audios are needed. In addition, some translations are needed.

import { AudioSearch } from '@ndla/audio-search';

const searchAudios = queryObject => {
  // Return new Promise of audio objects
};

const fetchAudio = id => {
  // Return new Promise of a single audio object
};

const onError = err => {
  // Handle error
};

const audioSelect = audio => {
  // Handle audio selection
};

const translations = {
  searchPlaceholder:  /* Translated string */,
  searchButtonTitle:  /* Translated string */,
  useAudio:           /* Translated string */,
  noResults:          /* Translated string */,
  paginationTranslations: {
        rootLabel: /* Translated string */,
        prevTriggerLabel: /* Translated string */,
        nextTriggerLabel: /* Translated string */,
      },
};


<AudioSearch
  translations={translations}
  fetchAudio={fetchAudio}
  searchAudios={searchAudios}
  onAudioSelect={audioSelect}
  onError={onError}
  queryObject={defaultQueryObject}
/>

A queryObject must look like this:

{
  query:    /* Query string */,
  page:     /* Page number */,
  pageSize: /* Page size (elements per page) */,
  locale:   /* The search language; usually provided by the front-end */,
}

Keywords

FAQs

Package last updated on 06 Sep 2024

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