2022-05-07 00:52:32 +02:00
|
|
|
import CustomText from '@components/Text'
|
2021-01-07 19:13:09 +01:00
|
|
|
import { StyleConstants } from '@utils/styles/constants'
|
|
|
|
import { useTheme } from '@utils/styles/ThemeManager'
|
|
|
|
import React from 'react'
|
2022-05-07 00:52:32 +02:00
|
|
|
import { View, ViewStyle } from 'react-native'
|
2021-01-23 02:41:50 +01:00
|
|
|
import { PlaceholderLine } from 'rn-placeholder'
|
2021-01-07 19:13:09 +01:00
|
|
|
|
|
|
|
export interface Props {
|
|
|
|
style?: ViewStyle
|
|
|
|
header: string
|
|
|
|
content?: string
|
|
|
|
potentialWidth?: number
|
|
|
|
}
|
|
|
|
|
|
|
|
const InstanceInfo = React.memo(
|
2021-03-06 21:01:38 +01:00
|
|
|
({ style, header, content, potentialWidth }: Props) => {
|
2022-02-12 14:51:01 +01:00
|
|
|
const { colors } = useTheme()
|
2021-01-07 19:13:09 +01:00
|
|
|
|
|
|
|
return (
|
2022-05-07 00:52:32 +02:00
|
|
|
<View
|
|
|
|
style={[
|
|
|
|
{
|
|
|
|
flex: 1,
|
|
|
|
marginTop: StyleConstants.Spacing.M,
|
|
|
|
paddingLeft: StyleConstants.Spacing.Global.PagePadding,
|
|
|
|
paddingRight: StyleConstants.Spacing.Global.PagePadding
|
|
|
|
},
|
|
|
|
style
|
|
|
|
]}
|
|
|
|
accessible
|
|
|
|
>
|
|
|
|
<CustomText
|
|
|
|
fontStyle='S'
|
|
|
|
style={{
|
|
|
|
marginBottom: StyleConstants.Spacing.XS,
|
|
|
|
color: colors.primaryDefault
|
|
|
|
}}
|
2022-05-10 23:19:26 +02:00
|
|
|
fontWeight='Bold'
|
2022-05-07 00:52:32 +02:00
|
|
|
children={header}
|
|
|
|
/>
|
2021-01-23 02:41:50 +01:00
|
|
|
{content ? (
|
2022-05-07 00:52:32 +02:00
|
|
|
<CustomText
|
|
|
|
fontStyle='M'
|
|
|
|
style={{ color: colors.primaryDefault }}
|
|
|
|
children={content}
|
|
|
|
/>
|
2021-01-23 02:41:50 +01:00
|
|
|
) : (
|
2021-03-06 21:01:38 +01:00
|
|
|
<PlaceholderLine
|
|
|
|
width={
|
|
|
|
potentialWidth
|
|
|
|
? potentialWidth * StyleConstants.Font.Size.M
|
|
|
|
: undefined
|
|
|
|
}
|
|
|
|
height={StyleConstants.Font.LineHeight.M}
|
2022-02-12 14:51:01 +01:00
|
|
|
color={colors.shimmerDefault}
|
2021-03-06 21:01:38 +01:00
|
|
|
noMargin
|
|
|
|
style={{ borderRadius: 0 }}
|
|
|
|
/>
|
2021-01-23 02:41:50 +01:00
|
|
|
)}
|
2021-01-07 19:13:09 +01:00
|
|
|
</View>
|
|
|
|
)
|
2021-03-06 21:01:38 +01:00
|
|
|
},
|
|
|
|
(prev, next) => prev.content === next.content
|
2021-01-07 19:13:09 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
export default InstanceInfo
|