Made with create-react-library
npm install --save undp-radar
import React, { Component } from 'react';
import MyComponent from 'undp-radar';
import 'undp-radar/dist/index.css';
import csvData2 from './assets/some_csv_data_file.csv';
const Example: React.FC = () => (
<RadarProvider>
<DataProvider>
<SetData
keys={{
techKey: 'Technology',
titleKey: 'Title',
horizonKey: 'Horizon',
quadrantKey: 'Quadrant',
useCaseKey: 'Use Case'
}}
/>
<RadarDataGenerator />
<AddCSV
csvFile={csvData2}
mapping={(item) =>
({
Quadrant: item['Quadrant'],
Title: item['Title'],
Horizon: item['Horizon'],
'Use Case': item['Use Case'],
Technology: Utilities.cleanupStringArray(item.Technology.split(','))
} as any)
}
/>
<RadarApp />
</DataProvider>
</RadarProvider>
);
Don't forget to add csv
files module declaration to your react-app-env.d.ts
like so:
/// <reference types="react-scripts" />
declare module '*.csv' {
const value: string;
export default value;
}
For further ideas on how to use this library (it has a lot going on under the hood) please check ./example/
project.
yarn build
on root foldercd example && yarn install & yarn start
Open two terminal windows.
- In one do
yarn start
(this will watch and recompile the lib on change). - In the next one to
cd example && yarn install & yarn start
MIT © nmpribeiro