diff --git a/src/components/ItemContainer/ItemContainer.web.js b/src/components/ItemContainer/ItemContainer.web.js index e818e0c..c61b7bf 100644 --- a/src/components/ItemContainer/ItemContainer.web.js +++ b/src/components/ItemContainer/ItemContainer.web.js @@ -1,23 +1,74 @@ import { View, StyleSheet } from "react-native"; -import React, { useState } from "react"; +import React, { useMemo, useState } from "react"; +import omit from "lodash/omit"; import BorderGradient from "../BorderGradient/BorderGradient"; import { responsiveHeight } from "react-native-responsive-dimensions"; import { BlurView } from "expo-blur"; import { Style } from "../../styles"; +const ITEM_BORDER_RADIUS = 24; +const CONTAINER_STYLE_PROPS = [ + "margin", + "marginTop", + "marginBottom", + "marginLeft", + "marginRight", + "marginHorizontal", + "marginVertical", + "alignSelf", + "alignItems", + "justifyContent", + "width", + "minWidth", + "maxWidth", +]; + const ItemContainer = ({ height = responsiveHeight(40), + width, + maxWidth, children, gradientProps, style, + disableKeyboardHeight = false, // parity with native signature }) => { const [containerLayout, setContainerLayout] = useState(null); + const flattenedStyle = StyleSheet.flatten(style) || {}; + const containerStyleOverrides = useMemo(() => { + return CONTAINER_STYLE_PROPS.reduce((acc, key) => { + if (typeof flattenedStyle[key] !== "undefined") { + acc[key] = flattenedStyle[key]; + } + return acc; + }, {}); + }, [flattenedStyle]); + + const { + width: styleWidth, + maxWidth: styleMaxWidth, + minWidth: styleMinWidth, + ...remainingContainerStyle + } = containerStyleOverrides; + + const gradientStyleOverrides = useMemo( + () => omit(flattenedStyle, CONTAINER_STYLE_PROPS), + [flattenedStyle] + ); + + const baseHeight = typeof height === "number" ? height : undefined; + const measuredHeight = containerLayout?.height ?? baseHeight; + const resolvedWidth = styleWidth ?? width ?? "100%"; + const resolvedMaxWidth = styleMaxWidth ?? maxWidth; return ( { setContainerLayout(e.nativeEvent.layout); }} > {children} @@ -66,18 +109,36 @@ const ItemContainer = ({ export default ItemContainer; const styles = StyleSheet.create({ + wrapper: { + position: "relative", + alignSelf: "stretch", + }, borderGradientStyle: { - borderWidth: 1, - borderRadius: 20, - shadowColor: "#000", + borderWidth: 1.2, + borderRadius: ITEM_BORDER_RADIUS, + shadowColor: "rgba(3, 0, 18, 0.58)", shadowOffset: { width: 0, height: 2, }, - shadowOpacity: 0.25, - shadowRadius: 3.84, - elevation: 100, + shadowOpacity: 0.22, + shadowRadius: 18, + elevation: 8, position: "absolute", width: "100%", }, + contentWrapper: { + borderRadius: ITEM_BORDER_RADIUS, + overflow: "hidden", + zIndex: 1, + }, + blurView: { + flex: 1, + width: "100%", + height: "100%", + paddingHorizontal: 32, + paddingVertical: 28, + justifyContent: "center", + alignSelf: "stretch", + }, }); diff --git a/src/screens/Login.js b/src/screens/Login.js index 1ae17c7..54708c7 100644 --- a/src/screens/Login.js +++ b/src/screens/Login.js @@ -15,11 +15,11 @@ import { } from "react-native"; import Svg, { Path } from "react-native-svg"; import { useGlobal } from "reactn"; +import { handleFirebaseError } from "../actions/signupActions.js"; import { background } from "../assets"; import GradientButton from "../components/GradientButton.js"; import { Input } from "../components/Input.js"; import ItemContainer from "../components/ItemContainer/ItemContainer"; -import { handleFirebaseError } from "../actions/signupActions.js"; import firebase, { usersRef } from "../config/firebase"; import { GOOGLE_ANDROID_CLIENT_ID, @@ -114,8 +114,7 @@ export default ({ navigation }) => { ? handleFirebaseError(e.code) : e?.message; setTooltip({ - text: - message || "Connexion Google impossible. Merci de réessayer.", + text: message || "Connexion Google impossible. Merci de réessayer.", type: "error", }); setLoading(false); @@ -202,37 +201,21 @@ export default ({ navigation }) => { title={isWeb ? "" : "Connexion"} hideBackButton > - - - - - - {"Bonjour !"} - - + + + + + {"Bonjour !"} + Nous sommes heureux de te revoir parmi nous. Prêt·e à reprendre le rythme ? - + { setValue={setEmail} isBlur /> - + { setValue={setPassword} isBlur /> - navigate(Routes.ForgotPassword)}> - - Mot de passe oublié? - + navigate(Routes.ForgotPassword)} + style={({ pressed }) => [ + styles.linkPressable, + pressed && styles.linkPressed, + ]} + > + Mot de passe oublié ? @@ -278,29 +259,16 @@ export default ({ navigation }) => { loading={loading} /> - - navigate(Routes.Register)}> - - Pas encore de compte?{" "} - - Créer un compte - - + + Pas encore de compte ? + navigate(Routes.Register)} + style={({ pressed }) => [ + styles.signupPressable, + pressed && styles.linkPressed, + ]} + > + Créer un compte @@ -372,23 +340,94 @@ const getNativeGoogleRedirectUri = () => { }; const styles = StyleSheet.create({ + screen: { + flex: 1, + width: "100%", + justifyContent: "center", + alignItems: "center", + }, + loginCard: { + width: "100%", + maxWidth: 520, + }, + cardContent: { + gap: 28, + paddingTop: 8, + width: "100%", + }, + greetingSection: { + gap: 6, + width: "100%", + }, + greetingTitle: { + fontSize: 22, + color: Palette.white, + fontFamily: FONT_FAMILY.InterSemiBold, + }, + greetingSubtitle: { + fontSize: 14, + color: Palette.gray, + fontFamily: FONT_FAMILY.InterRegular, + lineHeight: 20, + }, + formFields: { + gap: 20, + width: "100%", + }, + passwordField: { + gap: 8, + width: "100%", + }, + linkPressable: { + alignSelf: "flex-end", + }, + linkPressed: { + opacity: 0.6, + }, + linkText: { + fontSize: 12, + color: Palette.white, + fontFamily: FONT_FAMILY.InterRegular, + textAlign: "right", + }, + signupWrapper: { + flexDirection: "row", + flexWrap: "wrap", + alignItems: "center", + justifyContent: "center", + gap: 6, + }, + signupPrompt: { + fontSize: 14, + color: Palette.white, + fontFamily: FONT_FAMILY.InterRegular, + }, + signupPressable: { + paddingHorizontal: 2, + }, + signupLink: { + fontSize: 14, + color: Palette.white, + fontFamily: FONT_FAMILY.InterSemiBold, + }, webButton: { alignSelf: "center", + borderRadius: 12, width: "80%", - height: 48, - borderRadius: 4, + backgroundColor: Palette.white, borderWidth: 1, - borderColor: "#DADCE0", - justifyContent: "center", - shadowColor: "#000", - shadowOffset: { width: 0, height: 1 }, - shadowOpacity: 0.12, - shadowRadius: 2, - elevation: 1, + borderColor: "#E3E7EF", + paddingVertical: 12, + paddingHorizontal: 20, + shadowColor: "rgba(12, 6, 34, 0.08)", + shadowOffset: { width: 0, height: 8 }, + shadowOpacity: 0.3, + shadowRadius: 16, + elevation: 2, }, webButtonPressed: { - backgroundColor: "#F6F9FE", + backgroundColor: "#F4F7FF", }, webButtonDisabled: { opacity: 0.7, @@ -396,24 +435,25 @@ const styles = StyleSheet.create({ webContent: { flexDirection: "row", alignItems: "center", - justifyContent: "center", - paddingHorizontal: 12, + justifyContent: "space-between", + gap: 12, }, webIconContainer: { justifyContent: "center", alignItems: "center", - marginRight: 12, + width: 28, + height: 28, }, webText: { flex: 1, textAlign: "center", - fontSize: 14, - color: "#3C4043", + fontSize: 15, + color: "#202124", fontFamily: FONT_FAMILY.InterSemiBold, }, webRightSpacer: { - width: 18, - height: 18, + width: 24, + height: 24, }, nativeButtonWrapper: { alignSelf: "center", @@ -433,7 +473,7 @@ const styles = StyleSheet.create({ }); const GoogleLogo = () => ( - +