optimizations
This commit is contained in:
+15
-10
@@ -1,24 +1,26 @@
|
|||||||
import { ReactNode } from "react";
|
import { ReactNode } from "react";
|
||||||
import { View, Text, GestureResponderEvent } from "react-native";
|
import { View, GestureResponderEvent, StyleSheet } from "react-native";
|
||||||
import { Button as PaperButton } from "react-native-paper";
|
import { Button as PaperButton } from "react-native-paper";
|
||||||
|
|
||||||
|
import { colors } from "@/constants/colors";
|
||||||
|
|
||||||
interface ButtonProps {
|
interface ButtonProps {
|
||||||
buttonColor?: string;
|
buttonColor?: string;
|
||||||
buttonMode?: "outlined" | "contained";
|
buttonMode?: "outlined" | "contained";
|
||||||
buttonTextColor?: string;
|
buttonTextColor?: string;
|
||||||
onPress: (event: GestureResponderEvent) => void;
|
onPress: (event: GestureResponderEvent) => void;
|
||||||
disabled: boolean;
|
disabled?: boolean;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
icon?: string;
|
icon?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Button = ({
|
export const Button = ({
|
||||||
buttonColor = "#6750a4",
|
buttonColor = colors.primaryPurpleDark,
|
||||||
buttonMode = "outlined",
|
buttonMode = "outlined",
|
||||||
buttonTextColor = "white",
|
buttonTextColor = "white",
|
||||||
onPress,
|
onPress,
|
||||||
disabled,
|
disabled = false,
|
||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
icon,
|
icon,
|
||||||
@@ -33,14 +35,17 @@ export const Button = ({
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
textColor={buttonTextColor}
|
textColor={buttonTextColor}
|
||||||
icon={icon}
|
icon={icon}
|
||||||
style={{ borderRadius: 4, borderColor: "transparent" }}
|
style={styles.buttonStyle}
|
||||||
>
|
>
|
||||||
{typeof children === "string" || typeof children === "number" ? (
|
{children}
|
||||||
<Text>{children}</Text>
|
|
||||||
) : (
|
|
||||||
children
|
|
||||||
)}
|
|
||||||
</PaperButton>
|
</PaperButton>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
buttonStyle: {
|
||||||
|
borderRadius: 4,
|
||||||
|
borderColor: "transparent",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { TouchableOpacity, View } from "react-native";
|
import { TouchableOpacity, View } from "react-native";
|
||||||
import { Text } from "react-native-paper";
|
import { Text } from "react-native-paper";
|
||||||
|
|
||||||
|
import { colors } from "@/constants/colors";
|
||||||
|
|
||||||
interface CustomCheckboxProps {
|
interface CustomCheckboxProps {
|
||||||
checked: boolean;
|
checked: boolean;
|
||||||
onPress: () => void;
|
onPress: () => void;
|
||||||
@@ -32,7 +34,7 @@ export const CustomCheckbox = ({
|
|||||||
borderRadius: 2,
|
borderRadius: 2,
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
backgroundColor: checked ? "#6750a4" : "transparent",
|
backgroundColor: checked ? colors.primaryPurpleDark : "transparent",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{checked && (
|
{checked && (
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import { View, StyleSheet } from "react-native";
|
|||||||
import { Picker, PickerProps } from "@react-native-picker/picker";
|
import { Picker, PickerProps } from "@react-native-picker/picker";
|
||||||
import { Ionicons } from "@expo/vector-icons";
|
import { Ionicons } from "@expo/vector-icons";
|
||||||
|
|
||||||
|
import { colors } from "@/constants/colors";
|
||||||
|
|
||||||
export const PickerItem = Picker.Item;
|
export const PickerItem = Picker.Item;
|
||||||
|
|
||||||
interface CustomPickerProps extends PickerProps {
|
interface CustomPickerProps extends PickerProps {
|
||||||
@@ -17,9 +19,7 @@ export const CustomPicker = ({
|
|||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<Picker
|
<Picker
|
||||||
selectedValue={selectedValue}
|
selectedValue={selectedValue}
|
||||||
onValueChange={(itemValue, itemIndex) => {
|
onValueChange={onValueChange}
|
||||||
onValueChange?.(itemValue, itemIndex);
|
|
||||||
}}
|
|
||||||
style={[styles.pickerStyle, { appearance: "none" } as any]}
|
style={[styles.pickerStyle, { appearance: "none" } as any]}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
@@ -27,7 +27,7 @@ export const CustomPicker = ({
|
|||||||
<Ionicons
|
<Ionicons
|
||||||
name="chevron-down"
|
name="chevron-down"
|
||||||
size={20}
|
size={20}
|
||||||
color="#333"
|
color={colors.darkGray}
|
||||||
style={styles.customIcon}
|
style={styles.customIcon}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ export const SearchableDropdown = ({
|
|||||||
|
|
||||||
// Filter to only keep items that are still selected
|
// Filter to only keep items that are still selected
|
||||||
return Array.from(itemsMap.values()).filter((item) =>
|
return Array.from(itemsMap.values()).filter((item) =>
|
||||||
selectedIds.includes(item.id)
|
selectedIds.includes(item.id),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ export const SearchableDropdown = ({
|
|||||||
mode === "multi" ||
|
mode === "multi" ||
|
||||||
isOpen) && (
|
isOpen) && (
|
||||||
<TextInput
|
<TextInput
|
||||||
className={`border !mr-0 ${
|
className={`border mr-0! ${
|
||||||
error ? "border-highRisk" : "border-gray-300"
|
error ? "border-highRisk" : "border-gray-300"
|
||||||
} rounded p-2 text-base bg-white`}
|
} rounded p-2 text-base bg-white`}
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
export const colors = {
|
||||||
|
primaryPurple: "#49385D",
|
||||||
|
primaryPurpleLight: "#A78FA1",
|
||||||
|
primaryPurpleDark: "#6750a4",
|
||||||
|
darkGray: "#49454F",
|
||||||
|
darkMediumGray: "#7A757C",
|
||||||
|
mediumGray: "#C4BEBE",
|
||||||
|
lightGray: "#D9D9D9",
|
||||||
|
secondary: "#B768FF",
|
||||||
|
tertiary: "#2E1155",
|
||||||
|
accent: "#FF00FF",
|
||||||
|
background: "#1E0933",
|
||||||
|
highRisk: "#F83434",
|
||||||
|
mediumRisk: "#F8F834",
|
||||||
|
lowRisk: "#22C927",
|
||||||
|
orange: "#FF9800",
|
||||||
|
blue: "#56B3FA",
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
// CommonJS export for tailwind.config.js
|
||||||
|
export default colors;
|
||||||
Binary file not shown.
@@ -46,7 +46,7 @@ export const baseApi = createApi({
|
|||||||
return headers;
|
return headers;
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
refetchOnFocus: true,
|
refetchOnFocus: false,
|
||||||
refetchOnReconnect: true,
|
refetchOnReconnect: true,
|
||||||
tagTypes: ["Users", "Todos", "UserLogs"],
|
tagTypes: ["Users", "Todos", "UserLogs"],
|
||||||
endpoints: () => ({}),
|
endpoints: () => ({}),
|
||||||
|
|||||||
+10
-24
@@ -1,9 +1,13 @@
|
|||||||
/** @type {import('tailwindcss').Config} */
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
|
||||||
module.exports = {
|
import { colors } from "./constants/colors";
|
||||||
content: ["./components/**/*.{js,jsx,ts,tsx}", "./app/**/*.{js,jsx,ts,tsx}"],
|
|
||||||
presets: [require("nativewind/preset")],
|
export const content = [
|
||||||
theme: {
|
"./components/**/*.{js,jsx,ts,tsx}",
|
||||||
|
"./app/**/*.{js,jsx,ts,tsx}",
|
||||||
|
];
|
||||||
|
export const presets = [require("nativewind/preset")];
|
||||||
|
export const theme = {
|
||||||
extend: {
|
extend: {
|
||||||
fontFamily: {
|
fontFamily: {
|
||||||
inter: ["Inter", "sans-serif"],
|
inter: ["Inter", "sans-serif"],
|
||||||
@@ -11,25 +15,7 @@ module.exports = {
|
|||||||
fontSize: {
|
fontSize: {
|
||||||
inter: "16px",
|
inter: "16px",
|
||||||
},
|
},
|
||||||
colors: {
|
colors,
|
||||||
primaryPurple: "#49385D",
|
|
||||||
primaryPurpleLight: "#A78FA1",
|
|
||||||
primaryPurpleDark: "#6750a4",
|
|
||||||
darkGray: "#49454F",
|
|
||||||
darkMediumGray: "#7A757C",
|
|
||||||
mediumGray: "#C4BEBE",
|
|
||||||
lightGray: "#D9D9D9",
|
|
||||||
secondary: "#B768FF",
|
|
||||||
tertiary: "#2E1155",
|
|
||||||
accent: "#FF00FF",
|
|
||||||
background: "#1E0933",
|
|
||||||
highRisk: "#F83434",
|
|
||||||
mediumRisk: "#F8F834",
|
|
||||||
lowRisk: "#22C927",
|
|
||||||
orange: "#FF9800",
|
|
||||||
blue: "#56B3FA",
|
|
||||||
},
|
},
|
||||||
},
|
|
||||||
},
|
|
||||||
plugins: [],
|
|
||||||
};
|
};
|
||||||
|
export const plugins = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user