ndla-audio-search
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 => {
};
const fetchAudio = id => {
};
const onError = err => {
};
const audioSelect = audio => {
};
const translations = {
searchPlaceholder: ,
searchButtonTitle: ,
useAudio: ,
noResults: ,
};
<AudioSearch
translations={translations}
fetchAudio={fetchAudio}
searchAudios={searchAudios}
onAudioSelect={audioSelect}
onError={onError}
queryObject={defaultQueryObject}
/>
A queryObject
must look like this:
{
query: ,
page: ,
pageSize: ,
locale: ,
}