diff --git a/native/community-creation/community-configuration.react.js b/native/community-creation/community-configuration.react.js --- a/native/community-creation/community-configuration.react.js +++ b/native/community-creation/community-configuration.react.js @@ -1,7 +1,7 @@ // @flow import * as React from 'react'; -import { Text, TouchableOpacity, View } from 'react-native'; +import { Text, View } from 'react-native'; import { newThread, newThreadActionTypes } from 'lib/actions/thread-actions.js'; import { createLoadingStatusSelector } from 'lib/selectors/loading-selectors.js'; @@ -23,7 +23,7 @@ ThreadSettingsCategoryFooter, ThreadSettingsCategoryHeader, } from '../chat/settings/thread-settings-category.react.js'; -import CommIcon from '../components/comm-icon.react.js'; +import EnumSettingsOption from '../components/enum-settings-option.react.js'; import TextInput from '../components/text-input.react.js'; import { useCalendarQuery } from '../navigation/nav-selectors.js'; import { @@ -113,11 +113,6 @@ setAnnouncementSetting(!announcementSetting); }, [announcementSetting]); - let checkBoxFill; - if (announcementSetting) { - checkBoxFill = ; - } - return ( @@ -143,25 +138,13 @@ - - - - - - Announcement root - - Make it so that only admins can post to the root channel of the - community. - - - - {checkBoxFill} - - + mixed, +}; + +function EnumSettingsOption(props: EnumSettingsOptionProps): React.Node { + const styles = useStyles(unboundStyles); + const colors = useColors(); + + const enumIcon = React.useMemo(() => { + if (!props.icon) { + return null; + } + + return ( + + + + ); + }, [props.icon, styles.enumIcon, colors.purpleButton]); + + let checkBoxFill; + if (props.enumValue === true) { + checkBoxFill = ; + } + + const infoContainerStyle = React.useMemo(() => { + if (props.icon) { + return styles.enumInfoContainer; + } + + return { + ...styles.enumInfoContainer, + marginLeft: 30, + }; + }, [props.icon, styles.enumInfoContainer]); + + return ( + + {enumIcon} + + {props.name} + {props.description} + + + {checkBoxFill} + + + ); +} + +const unboundStyles = { + enumCell: { + flexDirection: 'row', + height: 96, + backgroundColor: 'panelForeground', + }, + enumIcon: { + padding: 16, + }, + enumInfoContainer: { + flex: 1, + flexDirection: 'column', + justifyContent: 'space-evenly', + padding: 8, + }, + enumInfoName: { + color: 'panelForegroundLabel', + fontSize: 18, + lineHeight: 24, + }, + enumInfoDescription: { + color: 'panelForegroundSecondaryLabel', + lineHeight: 18, + }, + enumCheckBoxContainer: { + padding: 22, + justifyContent: 'center', + alignItems: 'center', + }, + enumCheckBox: { + height: 32, + width: 32, + borderRadius: 3.5, + borderWidth: 1, + borderColor: 'panelSecondaryForegroundBorder', + justifyContent: 'center', + alignItems: 'center', + }, + enumCheckBoxFill: { + height: 20, + width: 20, + borderRadius: 2.1875, + backgroundColor: 'panelForegroundSecondaryLabel', + }, +}; + +export default EnumSettingsOption;