File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { ChartOptions , bb } from 'billboard.js' ;
2+ import { memo , useEffect , useRef } from 'react' ;
3+
4+ interface BBChartProps {
5+ options : ChartOptions ;
6+ }
7+
8+ const BBChart = ( { options } : BBChartProps ) => {
9+ const _chartRef = useRef < HTMLDivElement | null > ( null ) ;
10+
11+ useEffect ( ( ) => {
12+ if ( ! _chartRef . current ) return ;
13+
14+ const chart = bb . generate ( {
15+ bindto : _chartRef . current ,
16+ ...options
17+ } ) ;
18+
19+ return ( ) => {
20+ chart . destroy ( ) ;
21+ } ;
22+ } , [ options ] ) ;
23+
24+ return < div ref = { _chartRef } onClickCapture = { ( e ) => e . stopPropagation ( ) } /> ;
25+ } ;
26+
27+ export default memo ( BBChart ) ;
Original file line number Diff line number Diff line change 1+ import BBChart from './BBChart' ;
2+
3+ export { BBChart } ;
Original file line number Diff line number Diff line change 11import { ActionButton } from './ActionButton' ;
2+ import { BBChart } from './BBChart' ;
23import { BookmarkNotification } from './BookmarkNotification' ;
34import CatalogFilter , { CatalogFilterProps } from './CatalogFilter/CatalogFilter' ;
45import { ChapterCard } from './ChapterCard' ;
@@ -67,6 +68,7 @@ export { UserSearchField } from './UserSearchField';
6768
6869export {
6970 ActionButton ,
71+ BBChart ,
7072 BookmarkNotification ,
7173 CatalogCardDesignLogo ,
7274 CatalogFilter ,
@@ -148,6 +150,7 @@ export type {
148150export * from './CatalogDesignTable' ;
149151export * from './CatalogDetail' ;
150152export * from './Dialog' ;
153+ export * from './ResourceDetailFormatters' ;
151154export * from './ShareModal' ;
152155export * from './UserSearchField' ;
153156export * from './Workspaces' ;
You can’t perform that action at this time.
0 commit comments