import React from 'react' import Button from '../Button' import Divider from '../Divider' import Dropdown from '../Dropdown' import Icon from '../Icon' import StackView from '../StackView' import Text from '../Text' type ChurchCenterStatusProps = { /** * Determines status of Church Center App. */ ccAppEnabled?: boolean /** * Determines status of publishing to Church Center. */ ccPublishingEnabled?: boolean /** * Determines status of Church Center Web. */ ccWebEnabled?: boolean /** * Renders a text description in popover when status is active. */ description: string /** * Renders a text for Church Center destination button ("Visit {destinationLabel}"). */ destinationLabel: string /** * Renders a text description in popover when status is inactive. */ disabledDescription?: string /** * Pass props to the Dropdown component. */ dropdownProps?: object /** * Provide icon overrides for "check", "exclamationTriangle", "external", and "x" icons. */ icons?: object /** * Where the browser should navigate when destination button is pressed. */ productUrl: string /** * Where the browser should navigate when settings button is pressed. */ settingsUrl: string } export function ChurchCenterStatus({ ccAppEnabled = false, ccPublishingEnabled = false, ccWebEnabled = false, description, destinationLabel, disabledDescription = 'People cannot access this product on the web or mobile app.', dropdownProps = {}, icons, productUrl, settingsUrl, ...props }: ChurchCenterStatusProps) { const buttonProps: any = { distribution: 'start', fontWeight: 400, paddingHorizontal: 2, radius: 0, variant: 'naked', } const ccEnabled = ccAppEnabled || ccWebEnabled const icon = { check: 'checkmark', exclamationTriangle: 'exclamation-triangle-filled', external: 'external', x: 'close', ...icons, } return ( {!ccPublishingEnabled ? ( This product is not published on Church Center.{' '} {disabledDescription} ) : !ccEnabled ? ( Church Center is disabled. {disabledDescription} ) : ( {description} )} {ccEnabled && ccPublishingEnabled && ( Web Mobile app )} )} ) }