Files
jellyfin-audio-player/src/components/Shadow.tsx

36 lines
888 B
TypeScript
Raw Normal View History

2022-05-16 22:16:45 +02:00
import React, { PropsWithChildren } from 'react';
import { StyleSheet, View } from 'react-native';
2022-05-17 23:45:57 +02:00
export const shadow = StyleSheet.create({
small: {
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 2,
},
shadowOpacity: 0.1,
shadowRadius: 2.62,
elevation: 4,
2022-05-16 22:16:45 +02:00
},
2022-05-17 23:45:57 +02:00
medium: {
shadowColor: '#000',
shadowOffset: {
width: 0,
height: 3,
},
shadowOpacity: 0.1,
shadowRadius: 4.65,
elevation: 6,
}
2022-05-16 22:16:45 +02:00
});
type SizeProp = 'small' | 'medium';
const shadowMap: Record<SizeProp, StyleSheet.NamedStyles<unknown>> = {
2022-05-17 23:45:57 +02:00
'small': shadow.small,
'medium': shadow.medium,
2022-05-16 22:16:45 +02:00
};
export const ShadowWrapper = ({ children, size = 'small' }: PropsWithChildren<{ size?: SizeProp }>) => (
<View style={shadowMap[size]}>{children}</View>
);