// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {MessageDescriptor} from '@formatjs/intl/src/types'; import React from 'react'; import {StyleProp, TextStyle, View, ViewStyle} from 'react-native'; import FormattedText from '@components/formatted_text'; import {useTheme} from '@context/theme'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; const getStyleSheet = makeStyleSheetFromTheme((theme) => { return { container: { marginBottom: 30, }, header: { marginHorizontal: 15, marginBottom: 10, fontSize: 13, color: changeOpacity(theme.centerChannelColor, 0.5), }, footer: { marginTop: 10, marginHorizontal: 15, fontSize: 12, color: changeOpacity(theme.centerChannelColor, 0.5), }, }; }); export type SectionText = { id: string; defaultMessage: string; values?: MessageDescriptor; } export type BlockProps = { children: React.ReactNode; disableFooter?: boolean; disableHeader?: boolean; footerText?: SectionText; headerText?: SectionText; containerStyles?: StyleProp; headerStyles?: StyleProp; footerStyles?: StyleProp; } const Block = ({ children, containerStyles, disableFooter, disableHeader, footerText, headerStyles, headerText, footerStyles, }: BlockProps) => { const theme = useTheme(); const styles = getStyleSheet(theme); return ( {(headerText && !disableHeader) && } {children} {(footerText && !disableFooter) && } ); }; export default Block;