File tree Expand file tree Collapse file tree 3 files changed +56
-0
lines changed
src/custom/ResourceDetailFormatters Expand file tree Collapse file tree 3 files changed +56
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { OperatorDataContainer } from './styles' ;
3
+ import { isEmptyAtAllDepths } from './utils' ;
4
+
5
+ interface OperatorDataFormatterProps {
6
+ data : any ;
7
+ FormatStructuredData : any ;
8
+ propertyFormatter : any ;
9
+ }
10
+
11
+ export const OperatorDataFormatter = ( {
12
+ data,
13
+ FormatStructuredData,
14
+ propertyFormatter
15
+ } : OperatorDataFormatterProps ) => {
16
+ if ( ! data || isEmptyAtAllDepths ( data ) ) {
17
+ return null ;
18
+ }
19
+
20
+ return (
21
+ < OperatorDataContainer >
22
+ < FormatStructuredData data = { data } propertyFormatters = { propertyFormatter } isLevel = { false } />
23
+ </ OperatorDataContainer >
24
+ ) ;
25
+ } ;
Original file line number Diff line number Diff line change
1
+ import ExpandLessIcon from '@mui/icons-material/ExpandLess' ;
2
+ import ExpandMoreIcon from '@mui/icons-material/ExpandMore' ;
3
+ import { iconMedium } from '../../constants/iconsSizes' ;
4
+ import { useTheme } from '../../theme' ;
5
+
6
+ interface ExpandArrowProps {
7
+ expanded : boolean ;
8
+ }
9
+
10
+ const ExpandArrow : React . FC < ExpandArrowProps > = ( { expanded } ) => {
11
+ const theme = useTheme ( ) ;
12
+ return expanded ? (
13
+ < ExpandLessIcon fill = { theme . palette . icon . default } { ...iconMedium } />
14
+ ) : (
15
+ < ExpandMoreIcon fill = { theme . palette . icon . default } { ...iconMedium } />
16
+ ) ;
17
+ } ;
18
+
19
+ export default ExpandArrow ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+
3
+ export const LevelContext = React . createContext < number > ( 0 ) ;
4
+
5
+ interface LevelProps {
6
+ children : React . ReactNode ;
7
+ }
8
+
9
+ export const Level : React . FC < LevelProps > = ( { children } ) => {
10
+ const level = React . useContext ( LevelContext ) ;
11
+ return < LevelContext . Provider value = { level + 1 } > { children } </ LevelContext . Provider > ;
12
+ } ;
You can’t perform that action at this time.
0 commit comments