UNPKG

@wordpress/components

Version:
47 lines (41 loc) 984 B
/** * External dependencies */ import { View } from 'react-native'; /** * WordPress dependencies */ import { withPreferredColorScheme } from '@wordpress/compose'; import { useMemo } from '@wordpress/element'; /** * Internal dependencies */ import styles from './actions.scss'; import BottomSeparatorCover from './bottom-separator-cover'; import TextControl from '../text-control'; function PanelActions( { actions, getStylesFromColorScheme } ) { const mappedActions = useMemo( () => { return actions.map( ( { label, onPress } ) => { return ( <TextControl label={ label } onPress={ onPress } labelStyle={ styles.defaultLabelStyle } key={ label } /> ); } ); }, [ actions ] ); return ( <View style={ getStylesFromColorScheme( styles.panelActionsContainer, styles.panelActionsContainerDark ) } > { mappedActions } <BottomSeparatorCover /> </View> ); } export default withPreferredColorScheme( PanelActions );