fix styles dan feature component text

This commit is contained in:
2025-07-02 14:55:12 +08:00
parent 9667065bb3
commit e2744f0344
20 changed files with 258 additions and 80 deletions

View File

@@ -0,0 +1,82 @@
import { MainColor } from "@/constants/color-palet";
import {
TEXT_SIZE_LARGE,
TEXT_SIZE_MEDIUM,
TEXT_SIZE_SMALL,
} from "@/constants/constans-value";
import React from "react";
import { StyleProp, Text as RNText, TextStyle, StyleSheet } from "react-native";
interface TextCustomProps {
children: string;
style?: StyleProp<TextStyle>;
bold?: boolean;
semiBold?: boolean;
size?: "default" | "large" | "small";
color?: "default" | "primary" | "secondary";
}
const TextCustom: React.FC<TextCustomProps> = ({
children,
style,
bold = false,
semiBold = false,
size = "default",
color = "default",
}) => {
const getStyle = () => {
let selectedStyles = [];
// Base style
selectedStyles.push(styles.default);
// Font weight
if (bold) selectedStyles.push(styles.bold);
else if (semiBold) selectedStyles.push(styles.semiBold);
// Size
if (size === "large") selectedStyles.push(styles.large);
else if (size === "small") selectedStyles.push(styles.small);
// Color
if (color === "primary") selectedStyles.push(styles.primaryColor);
else if (color === "secondary") selectedStyles.push(styles.secondaryColor);
// Override with passed style
if (style) selectedStyles.push(style);
return selectedStyles;
};
return <RNText style={getStyle()}>{children}</RNText>;
};
export default TextCustom;
export const styles = StyleSheet.create({
default: {
// fontFamily: "Poppins-Regular", // Ganti dengan font yang kamu gunakan
fontSize: TEXT_SIZE_MEDIUM,
color: MainColor.white,
},
bold: {
fontFamily: "Poppins-Bold",
fontWeight: "700",
},
semiBold: {
fontFamily: "Poppins-SemiBold",
fontWeight: "500",
},
large: {
fontSize: TEXT_SIZE_LARGE,
},
small: {
fontSize: TEXT_SIZE_SMALL,
},
primaryColor: {
color: "#007AFF", // Warna utama aplikasi kamu
},
secondaryColor: {
color: "#666",
},
});

View File

@@ -1,5 +1,5 @@
import { MainColor } from "@/constants/color-palet";
import { Styles } from "@/styles/global-styles";
import { GStyles } from "@/styles/global-styles";
import { ImageBackground, ScrollView, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
@@ -34,12 +34,12 @@ const ViewWrapper = ({
<ImageBackground
source={assetBackground}
resizeMode="cover"
style={Styles.imageBackground}
style={GStyles.imageBackground}
>
<View style={Styles.containerWithBackground}>{children}</View>
<View style={GStyles.containerWithBackground}>{children}</View>
</ImageBackground>
) : (
<View style={Styles.container}>{children}</View>
<View style={GStyles.container}>{children}</View>
)}
</ScrollView>
{tabBarComponent}

View File

@@ -10,6 +10,8 @@ import MenuDrawerDynamicGrid from "./Drawer/MenuDrawerDynamicGird";
import ViewWrapper from "./_ShareComponent/ViewWrapper";
import TruncatedText from "./_ShareComponent/TruncatedText";
import Spacing from "./_ShareComponent/Spacing";
// Text
import TextCustom from "./Text/TextCustom";
// TextInput
import { TextInputCustom } from "./TextInput/TextInputCustom";
@@ -25,6 +27,8 @@ export {
Spacing,
TruncatedText,
ViewWrapper,
// Text
TextCustom,
// TextInput
TextInputCustom,
};