A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
refactor button
ammarahm-ed9e2be792f87d
diff --git a/apps/mobile/src/components/Button/index.js b/apps/mobile/src/components/Button/index.jsindex 62acca011..d3facfc46 100644--- a/apps/mobile/src/components/Button/index.js+++ b/apps/mobile/src/components/Button/index.js@@ -5,28 +5,44 @@ import {useTracked} from '../../provider';import {PressableButton} from '../PressableButton';import {ph, pv, SIZE, WEIGHT} from '../../utils/SizeUtils';+const BUTTON_TYPES = {+ transparent: {+ primary: 'transparent',+ text: 'accent',+ selected: 'shade',+ },+ gray: {+ primary: 'transparent',+ text: 'icon',+ selected: 'nav',+ },+ accent: {+ primary: 'accent',+ text: 'white',+ selected: 'accent',+ },+};+export const Button = ({height = 40,- width = '48%',+ width = null,onPress = () => {},loading = false,- grayed,title = '',icon,- color,fontSize = SIZE.sm,- iconColor = 'accent',+ type = 'transparent',}) => {const [state] = useTracked();const {colors} = state;- const usedColor = colors[color];return (<PressableButtononPress={onPress}- color={usedColor || "transparent"}- selectedColor={grayed ? colors.nav : colors.shade}- alpha={grayed ? (!colors.night ? -0.02 : 0.02) : -0.1}+ disabled={loading}+ color={colors[BUTTON_TYPES[type].primary]}+ selectedColor={colors[BUTTON_TYPES[type].selected]}+ alpha={!colors.night ? -0.04 : 0.04}customStyle={{height: height,width: width ? width : null,@@ -38,21 +54,23 @@ export const Button = ({alignItems: 'center',flexDirection: 'row',}}>- {loading ? <ActivityIndicator color={usedColor} /> : null}+ {loading ? (+ <ActivityIndicator color={colors[BUTTON_TYPES[type].text]} />+ ) : null}{icon && !loading ? (<Iconname={icon}style={{marginRight: 0,}}- color={grayed ? colors.icon : colors[iconColor]}+ color={color[BUTTON_TYPES[type].text]}size={SIZE.md}/>) : null}<Textstyle={[styles.buttonText,- {color: grayed ? colors.icon : colors[iconColor], fontSize: fontSize},+ {color: colors[BUTTON_TYPES[type].text], fontSize: fontSize},]}>{title}</Text>diff --git a/apps/mobile/src/components/LoginDialog/index.js b/apps/mobile/src/components/LoginDialog/index.jsindex 8d187308a..54ba44341 100644--- a/apps/mobile/src/components/LoginDialog/index.js+++ b/apps/mobile/src/components/LoginDialog/index.js@@ -255,32 +255,6 @@ const LoginDialog = () => {...getElevation(DDS.isTab ? 5 : 0),}}><Toast context="local" />- {loggingIn || signingIn ? (- <View- style={{- backgroundColor: !colors.night- ? 'rgba(0,0,0,0.2)'- : 'rgba(255,255,255,0.2)',- zIndex: 10,- position: 'absolute',- justifyContent: 'center',- alignItems: 'center',- width: '100%',- height: '100%',- }}>- <Loading- tagline={status}- customStyle={{- alignSelf: 'center',- backgroundColor: colors.bg,- ...getElevation(5),- borderRadius: 5,- width: '80%',- height: 100,- }}- />- </View>- ) : null}{DDS.isTab ? null : (<View@@ -341,6 +315,7 @@ const LoginDialog = () => {});}}}+ editable={!loggingIn || !signingIn}autoCapitalize="none"defaultValue={username}onBlur={() => {@@ -431,6 +406,7 @@ const LoginDialog = () => {});}}}+ editable={!loggingIn || !signingIn}autoCapitalize="none"defaultValue={email}onBlur={() => {@@ -529,6 +505,7 @@ const LoginDialog = () => {});}}}+ editable={!loggingIn || !signingIn}autoCapitalize="none"defaultValue={password}onBlur={() => {@@ -624,7 +601,11 @@ const LoginDialog = () => {<><TextInputref={_passConfirm}- editable={password && !invalidPassword ? true : false}+ editable={+ !loggingIn || !signingIn || (password && !invalidPassword)+ ? true+ : false+ }defaultValue={passwordReEnter}autoCapitalize="none"onChangeText={(value) => {@@ -700,6 +681,7 @@ const LoginDialog = () => {<><Seperator /><TouchableOpacity+ disabled={loggingIn || signingIn}onPress={() => {setUserConsent(!userConsent);}}@@ -754,11 +736,11 @@ const LoginDialog = () => {width: '100%',}}><Button- title={login ? 'Login' : 'Create Account'}+ title={ login ? 'Login' : 'Create Account'}onPress={login ? loginUser : signupUser}width="100%"- color="accent"- iconColor="white"+ type="accent"+ loading={loggingIn || signingIn}fontSize={SIZE.md}height={50}/>diff --git a/apps/mobile/src/components/PressableButton/index.js b/apps/mobile/src/components/PressableButton/index.jsindex 8fd109fb7..466f139c3 100644--- a/apps/mobile/src/components/PressableButton/index.js+++ b/apps/mobile/src/components/PressableButton/index.js@@ -16,10 +16,12 @@ export const PressableButton = ({onLongPress,hitSlop,testID,+ disabled}) => {return (<PressabletestID={testID}+ disabled={disabled}hitSlop={hitSlop}activeOpacity={opacity}onPress={onPress}