@janiscommerce/ui-native
Version:
components library for Janis app
34 lines (33 loc) • 978 B
JavaScript
import React from 'react';
import { StyleSheet, View } from 'react-native';
import { palette } from '../../../theme/palette';
const BaseCardList = ({ children, isSelected = false, style, ...props }) => {
if (!children) {
return null;
}
const styles = StyleSheet.create({
container: {
backgroundColor: palette.base.white,
borderRadius: 20,
width: '100%',
padding: 16,
elevation: 2,
shadowColor: palette.black.main,
},
selectedContainer: {
borderWidth: 2,
borderColor: palette.primary.main,
elevation: 4,
shadowColor: palette.primary.main,
},
});
const activeStyles = [
styles.container,
isSelected && styles.selectedContainer,
style && style,
].filter(Boolean);
return (<View style={activeStyles} {...props}>
{children}
</View>);
};
export default BaseCardList;