update theme dark, light mode
This commit is contained in:
154
components/theme-example.tsx
Normal file
154
components/theme-example.tsx
Normal file
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
* Example component demonstrating theme usage
|
||||
* Shows different ways to use the theme system
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { View, Text, TouchableOpacity, ScrollView } from "react-native";
|
||||
import { ThemedText } from "@/components/themed-text";
|
||||
import { ThemedView } from "@/components/themed-view";
|
||||
import { useAppTheme } from "@/hooks/use-app-theme";
|
||||
import { useThemeColor } from "@/hooks/use-theme-color";
|
||||
|
||||
export function ThemeExampleComponent() {
|
||||
const { colors, styles, utils } = useAppTheme();
|
||||
|
||||
// Example of using useThemeColor hook
|
||||
const customTextColor = useThemeColor({}, "textSecondary");
|
||||
const customBackgroundColor = useThemeColor({}, "surfaceSecondary");
|
||||
|
||||
return (
|
||||
<ScrollView style={styles.container}>
|
||||
<ThemedView style={styles.surface}>
|
||||
<ThemedText type="title">Theme Examples</ThemedText>
|
||||
|
||||
{/* Using themed components */}
|
||||
<ThemedText type="subtitle">Themed Components</ThemedText>
|
||||
<ThemedView style={styles.card}>
|
||||
<ThemedText>This is a themed text</ThemedText>
|
||||
<ThemedText type="defaultSemiBold">
|
||||
This is bold themed text
|
||||
</ThemedText>
|
||||
</ThemedView>
|
||||
|
||||
{/* Using theme colors directly */}
|
||||
<ThemedText type="subtitle">Direct Color Usage</ThemedText>
|
||||
<View
|
||||
style={[styles.card, { borderColor: colors.primary, borderWidth: 2 }]}
|
||||
>
|
||||
<Text style={{ color: colors.text, fontSize: 16 }}>
|
||||
Using colors.text directly
|
||||
</Text>
|
||||
<Text
|
||||
style={{ color: colors.primary, fontSize: 14, fontWeight: "600" }}
|
||||
>
|
||||
Primary color text
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
{/* Using pre-styled components */}
|
||||
<ThemedText type="subtitle">Pre-styled Components</ThemedText>
|
||||
<View style={styles.card}>
|
||||
<TouchableOpacity style={styles.primaryButton}>
|
||||
<Text style={styles.primaryButtonText}>Primary Button</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
<TouchableOpacity style={styles.secondaryButton}>
|
||||
<Text style={styles.secondaryButtonText}>Secondary Button</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
{/* Status containers */}
|
||||
<ThemedText type="subtitle">Status Indicators</ThemedText>
|
||||
<View style={styles.card}>
|
||||
<View style={styles.successContainer}>
|
||||
<Text style={{ color: colors.success, fontWeight: "600" }}>
|
||||
Success Message
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={styles.warningContainer}>
|
||||
<Text style={{ color: colors.warning, fontWeight: "600" }}>
|
||||
Warning Message
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={styles.errorContainer}>
|
||||
<Text style={{ color: colors.error, fontWeight: "600" }}>
|
||||
Error Message
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Using opacity colors */}
|
||||
<ThemedText type="subtitle">Opacity Colors</ThemedText>
|
||||
<View style={styles.card}>
|
||||
<View
|
||||
style={[
|
||||
styles.surface,
|
||||
{ backgroundColor: utils.getOpacityColor("primary", 0.1) },
|
||||
]}
|
||||
>
|
||||
<Text style={{ color: colors.primary }}>
|
||||
Primary with 10% opacity background
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View
|
||||
style={[
|
||||
styles.surface,
|
||||
{ backgroundColor: utils.getOpacityColor("error", 0.2) },
|
||||
]}
|
||||
>
|
||||
<Text style={{ color: colors.error }}>
|
||||
Error with 20% opacity background
|
||||
</Text>
|
||||
</View>
|
||||
</View>
|
||||
|
||||
{/* Theme utilities */}
|
||||
<ThemedText type="subtitle">Theme Utilities</ThemedText>
|
||||
<View style={styles.card}>
|
||||
<Text style={{ color: colors.text }}>
|
||||
Is Dark Mode: {utils.isDark ? "Yes" : "No"}
|
||||
</Text>
|
||||
<Text style={{ color: colors.text }}>
|
||||
Is Light Mode: {utils.isLight ? "Yes" : "No"}
|
||||
</Text>
|
||||
|
||||
<TouchableOpacity
|
||||
style={[styles.primaryButton, { marginTop: 10 }]}
|
||||
onPress={utils.toggleTheme}
|
||||
>
|
||||
<Text style={styles.primaryButtonText}>
|
||||
Toggle Theme (Light/Dark)
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
</View>
|
||||
|
||||
{/* Custom themed component example */}
|
||||
<ThemedText type="subtitle">Custom Component</ThemedText>
|
||||
<View
|
||||
style={[
|
||||
styles.card,
|
||||
{
|
||||
backgroundColor: customBackgroundColor,
|
||||
borderColor: colors.border,
|
||||
borderWidth: 1,
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Text
|
||||
style={{
|
||||
color: customTextColor,
|
||||
fontSize: 16,
|
||||
textAlign: "center",
|
||||
}}
|
||||
>
|
||||
Custom component using useThemeColor
|
||||
</Text>
|
||||
</View>
|
||||
</ThemedView>
|
||||
</ScrollView>
|
||||
);
|
||||
}
|
||||
109
components/theme-toggle.tsx
Normal file
109
components/theme-toggle.tsx
Normal file
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* Theme Toggle Component for switching between light, dark, and system themes
|
||||
*/
|
||||
|
||||
import React from "react";
|
||||
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
||||
import { ThemedText } from "@/components/themed-text";
|
||||
import { useThemeContext } from "@/hooks/use-theme-context";
|
||||
import { useI18n } from "@/hooks/use-i18n";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
|
||||
interface ThemeToggleProps {
|
||||
style?: any;
|
||||
}
|
||||
|
||||
export function ThemeToggle({ style }: ThemeToggleProps) {
|
||||
const { themeMode, setThemeMode, colors } = useThemeContext();
|
||||
const { t } = useI18n();
|
||||
|
||||
const themeOptions = [
|
||||
{
|
||||
mode: "light" as const,
|
||||
label: t("common.theme_light"),
|
||||
icon: "sunny-outline" as const,
|
||||
},
|
||||
{
|
||||
mode: "dark" as const,
|
||||
label: t("common.theme_dark"),
|
||||
icon: "moon-outline" as const,
|
||||
},
|
||||
{
|
||||
mode: "system" as const,
|
||||
label: t("common.theme_system"),
|
||||
icon: "phone-portrait-outline" as const,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<View
|
||||
style={[styles.container, style, { backgroundColor: colors.surface }]}
|
||||
>
|
||||
<ThemedText style={styles.title}>{t("common.theme")}</ThemedText>
|
||||
<View style={styles.optionsContainer}>
|
||||
{themeOptions.map((option) => (
|
||||
<TouchableOpacity
|
||||
key={option.mode}
|
||||
style={[
|
||||
styles.option,
|
||||
{
|
||||
backgroundColor:
|
||||
themeMode === option.mode
|
||||
? colors.primary
|
||||
: colors.backgroundSecondary,
|
||||
borderColor: colors.border,
|
||||
},
|
||||
]}
|
||||
onPress={() => setThemeMode(option.mode)}
|
||||
>
|
||||
<Ionicons
|
||||
name={option.icon}
|
||||
size={20}
|
||||
color={themeMode === option.mode ? "#fff" : colors.icon}
|
||||
/>
|
||||
<ThemedText
|
||||
style={[
|
||||
styles.optionText,
|
||||
{ color: themeMode === option.mode ? "#fff" : colors.text },
|
||||
]}
|
||||
>
|
||||
{option.label}
|
||||
</ThemedText>
|
||||
</TouchableOpacity>
|
||||
))}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
padding: 16,
|
||||
borderRadius: 12,
|
||||
marginVertical: 8,
|
||||
},
|
||||
title: {
|
||||
fontSize: 16,
|
||||
fontWeight: "600",
|
||||
marginBottom: 12,
|
||||
},
|
||||
optionsContainer: {
|
||||
flexDirection: "row",
|
||||
gap: 8,
|
||||
},
|
||||
option: {
|
||||
flex: 1,
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
paddingVertical: 12,
|
||||
paddingHorizontal: 8,
|
||||
borderRadius: 8,
|
||||
borderWidth: 1,
|
||||
gap: 6,
|
||||
},
|
||||
optionText: {
|
||||
fontSize: 14,
|
||||
fontWeight: "500",
|
||||
},
|
||||
});
|
||||
@@ -1,10 +1,12 @@
|
||||
import { IconSymbol } from "@/components/ui/icon-symbol";
|
||||
import { useI18n } from "@/hooks/use-i18n";
|
||||
import { useTrip } from "@/state/use-trip";
|
||||
import React, { useRef, useState } from "react";
|
||||
import React, { useMemo, useRef, useState } from "react";
|
||||
import { Animated, Text, TouchableOpacity, View } from "react-native";
|
||||
import CrewDetailModal from "./modal/CrewDetailModal";
|
||||
import styles from "./style/CrewListTable.styles";
|
||||
import { useAppTheme } from "@/hooks/use-app-theme";
|
||||
import { useThemeContext } from "@/hooks/use-theme-context";
|
||||
import { createTableStyles } from "./ThemedTable";
|
||||
|
||||
const CrewListTable: React.FC = () => {
|
||||
const [collapsed, setCollapsed] = useState(true);
|
||||
@@ -15,6 +17,9 @@ const CrewListTable: React.FC = () => {
|
||||
null
|
||||
);
|
||||
const { t } = useI18n();
|
||||
const { colorScheme } = useAppTheme();
|
||||
const { colors } = useThemeContext();
|
||||
const styles = useMemo(() => createTableStyles(colorScheme), [colorScheme]);
|
||||
|
||||
const { trip } = useTrip();
|
||||
|
||||
@@ -60,7 +65,7 @@ const CrewListTable: React.FC = () => {
|
||||
<IconSymbol
|
||||
name={collapsed ? "chevron.down" : "chevron.up"}
|
||||
size={16}
|
||||
color="#000"
|
||||
color={colors.icon}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import { IconSymbol } from "@/components/ui/icon-symbol";
|
||||
import { useI18n } from "@/hooks/use-i18n";
|
||||
import { useTrip } from "@/state/use-trip";
|
||||
import React, { useRef, useState } from "react";
|
||||
import React, { useMemo, useRef, useState } from "react";
|
||||
import { Animated, Text, TouchableOpacity, View } from "react-native";
|
||||
import styles from "./style/FishingToolsTable.styles";
|
||||
import { useAppTheme } from "@/hooks/use-app-theme";
|
||||
import { useThemeContext } from "@/hooks/use-theme-context";
|
||||
import { createTableStyles } from "./ThemedTable";
|
||||
|
||||
const FishingToolsTable: React.FC = () => {
|
||||
const [collapsed, setCollapsed] = useState(true);
|
||||
const [contentHeight, setContentHeight] = useState<number>(0);
|
||||
const animatedHeight = useRef(new Animated.Value(0)).current;
|
||||
const { t } = useI18n();
|
||||
const { colorScheme } = useAppTheme();
|
||||
const { colors } = useThemeContext();
|
||||
const styles = useMemo(() => createTableStyles(colorScheme), [colorScheme]);
|
||||
|
||||
const { trip } = useTrip();
|
||||
const data: Model.FishingGear[] = trip?.fishing_gears ?? [];
|
||||
@@ -38,7 +43,7 @@ const FishingToolsTable: React.FC = () => {
|
||||
<IconSymbol
|
||||
name={collapsed ? "chevron.down" : "chevron.up"}
|
||||
size={16}
|
||||
color="#000"
|
||||
color={colors.icon}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@ import { IconSymbol } from "@/components/ui/icon-symbol";
|
||||
import { useI18n } from "@/hooks/use-i18n";
|
||||
import { useFishes } from "@/state/use-fish";
|
||||
import { useTrip } from "@/state/use-trip";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import React, { useEffect, useMemo, useRef, useState } from "react";
|
||||
import { Animated, Text, TouchableOpacity, View } from "react-native";
|
||||
import CreateOrUpdateHaulModal from "./modal/CreateOrUpdateHaulModal";
|
||||
import styles from "./style/NetListTable.styles";
|
||||
import { useAppTheme } from "@/hooks/use-app-theme";
|
||||
import { useThemeContext } from "@/hooks/use-theme-context";
|
||||
import { createTableStyles } from "./ThemedTable";
|
||||
|
||||
const NetListTable: React.FC = () => {
|
||||
const [collapsed, setCollapsed] = useState(true);
|
||||
@@ -14,17 +16,16 @@ const NetListTable: React.FC = () => {
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const [selectedNet, setSelectedNet] = useState<Model.FishingLog | null>(null);
|
||||
const { t } = useI18n();
|
||||
const { colorScheme } = useAppTheme();
|
||||
const { colors } = useThemeContext();
|
||||
const styles = useMemo(() => createTableStyles(colorScheme), [colorScheme]);
|
||||
|
||||
const { trip } = useTrip();
|
||||
const { fishSpecies, getFishSpecies } = useFishes();
|
||||
useEffect(() => {
|
||||
getFishSpecies();
|
||||
}, []);
|
||||
|
||||
// useEffect(() => {
|
||||
// console.log("Trip thay đổi: ", trip?.fishing_logs?.length);
|
||||
// }, [trip]);
|
||||
// const data: Model.FishingLog[] = trip?.fishing_logs ?? [];
|
||||
|
||||
const handleToggle = () => {
|
||||
const toValue = collapsed ? contentHeight : 0;
|
||||
Animated.timing(animatedHeight, {
|
||||
@@ -60,7 +61,7 @@ const NetListTable: React.FC = () => {
|
||||
<IconSymbol
|
||||
name={collapsed ? "chevron.down" : "chevron.up"}
|
||||
size={16}
|
||||
color="#000"
|
||||
color={colors.icon}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
|
||||
|
||||
29
components/tripInfo/ThemedTable.tsx
Normal file
29
components/tripInfo/ThemedTable.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Wrapper component to easily apply theme-aware table styles
|
||||
*/
|
||||
|
||||
import React, { useMemo } from "react";
|
||||
import { View, ViewProps } from "react-native";
|
||||
import { useAppTheme } from "@/hooks/use-app-theme";
|
||||
import { createTableStyles } from "./style/createTableStyles";
|
||||
|
||||
interface ThemedTableProps extends ViewProps {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export function ThemedTable({ style, children, ...props }: ThemedTableProps) {
|
||||
const { colorScheme } = useAppTheme();
|
||||
const tableStyles = useMemo(
|
||||
() => createTableStyles(colorScheme),
|
||||
[colorScheme]
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={[tableStyles.container, style]} {...props}>
|
||||
{children}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export { createTableStyles };
|
||||
export type { TableStyles } from "./style/createTableStyles";
|
||||
@@ -1,14 +1,12 @@
|
||||
import { IconSymbol } from "@/components/ui/icon-symbol";
|
||||
import { useI18n } from "@/hooks/use-i18n";
|
||||
import { useAppTheme } from "@/hooks/use-app-theme";
|
||||
import { useTrip } from "@/state/use-trip";
|
||||
import React, { useRef, useState } from "react";
|
||||
import { Animated, Text, TouchableOpacity, View } from "react-native";
|
||||
import { createTableStyles } from "./style/createTableStyles";
|
||||
import TripCostDetailModal from "./modal/TripCostDetailModal";
|
||||
import styles from "./style/TripCostTable.styles";
|
||||
|
||||
// ---------------------------
|
||||
// 💰 Component chính
|
||||
// ---------------------------
|
||||
import React, { useRef, useState, useMemo } from "react";
|
||||
import { Animated, Text, TouchableOpacity, View } from "react-native";
|
||||
import { useThemeContext } from "@/hooks/use-theme-context";
|
||||
|
||||
const TripCostTable: React.FC = () => {
|
||||
const [collapsed, setCollapsed] = useState(true);
|
||||
@@ -16,9 +14,13 @@ const TripCostTable: React.FC = () => {
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const animatedHeight = useRef(new Animated.Value(0)).current;
|
||||
const { t } = useI18n();
|
||||
const { colorScheme } = useAppTheme();
|
||||
const { colors } = useThemeContext();
|
||||
|
||||
const { trip } = useTrip();
|
||||
|
||||
const styles = useMemo(() => createTableStyles(colorScheme), [colorScheme]);
|
||||
|
||||
const data: Model.TripCost[] = trip?.trip_cost ?? [];
|
||||
const tongCong = data.reduce((sum, item) => sum + item.total_cost, 0);
|
||||
|
||||
@@ -54,19 +56,14 @@ const TripCostTable: React.FC = () => {
|
||||
>
|
||||
<Text style={styles.title}>{t("trip.costTable.title")}</Text>
|
||||
{collapsed && (
|
||||
<Text
|
||||
style={[
|
||||
styles.title,
|
||||
{ color: "#ff6600", fontWeight: "bold", marginLeft: 8 },
|
||||
]}
|
||||
>
|
||||
<Text style={[styles.totalCollapsed]}>
|
||||
{tongCong.toLocaleString()}
|
||||
</Text>
|
||||
)}
|
||||
<IconSymbol
|
||||
name={collapsed ? "chevron.down" : "chevron.up"}
|
||||
size={15}
|
||||
color="#000000"
|
||||
color={colors.icon}
|
||||
/>
|
||||
</TouchableOpacity>
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
export default StyleSheet.create({
|
||||
container: {
|
||||
width: "100%",
|
||||
backgroundColor: "#fff",
|
||||
borderRadius: 12,
|
||||
padding: 16,
|
||||
marginVertical: 10,
|
||||
borderWidth: 1,
|
||||
borderColor: "#fff",
|
||||
shadowColor: "#000",
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 4,
|
||||
elevation: 2,
|
||||
},
|
||||
headerRow: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
},
|
||||
title: {
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
},
|
||||
totalCollapsed: {
|
||||
color: "#ff6600",
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
textAlign: "center",
|
||||
},
|
||||
row: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
paddingVertical: 8,
|
||||
borderBottomWidth: 0.5,
|
||||
borderBottomColor: "#eee",
|
||||
},
|
||||
tableHeader: {
|
||||
backgroundColor: "#fafafa",
|
||||
borderRadius: 6,
|
||||
marginTop: 10,
|
||||
},
|
||||
cell: {
|
||||
flex: 1,
|
||||
fontSize: 15,
|
||||
color: "#111",
|
||||
textAlign: "center",
|
||||
},
|
||||
cellWrapper: {
|
||||
flex: 1,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
},
|
||||
right: {
|
||||
textAlign: "center",
|
||||
},
|
||||
headerText: {
|
||||
fontWeight: "600",
|
||||
},
|
||||
footerText: {
|
||||
color: "#007bff",
|
||||
fontWeight: "600",
|
||||
},
|
||||
footerTotal: {
|
||||
color: "#ff6600",
|
||||
fontWeight: "800",
|
||||
},
|
||||
linkText: {
|
||||
color: "#007AFF",
|
||||
textDecorationLine: "underline",
|
||||
},
|
||||
});
|
||||
@@ -1,66 +0,0 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
export default StyleSheet.create({
|
||||
container: {
|
||||
width: "100%",
|
||||
backgroundColor: "#fff",
|
||||
borderRadius: 12,
|
||||
padding: 16,
|
||||
marginVertical: 10,
|
||||
borderWidth: 1,
|
||||
borderColor: "#fff",
|
||||
shadowColor: "#000",
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 4,
|
||||
elevation: 2,
|
||||
},
|
||||
headerRow: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
},
|
||||
title: {
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
},
|
||||
totalCollapsed: {
|
||||
color: "#ff6600",
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
textAlign: "center",
|
||||
},
|
||||
row: {
|
||||
flexDirection: "row",
|
||||
paddingVertical: 8,
|
||||
borderBottomWidth: 0.5,
|
||||
borderBottomColor: "#eee",
|
||||
paddingLeft: 15,
|
||||
},
|
||||
cell: {
|
||||
flex: 1,
|
||||
fontSize: 15,
|
||||
color: "#111",
|
||||
},
|
||||
left: {
|
||||
textAlign: "left",
|
||||
},
|
||||
right: {
|
||||
textAlign: "center",
|
||||
},
|
||||
tableHeader: {
|
||||
backgroundColor: "#fafafa",
|
||||
borderRadius: 6,
|
||||
marginTop: 10,
|
||||
},
|
||||
headerText: {
|
||||
fontWeight: "600",
|
||||
},
|
||||
footerText: {
|
||||
color: "#007bff",
|
||||
fontWeight: "600",
|
||||
},
|
||||
footerTotal: {
|
||||
color: "#ff6600",
|
||||
fontWeight: "800",
|
||||
},
|
||||
});
|
||||
@@ -1,78 +0,0 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
export default StyleSheet.create({
|
||||
container: {
|
||||
width: "100%",
|
||||
backgroundColor: "#fff",
|
||||
borderRadius: 12,
|
||||
padding: 16,
|
||||
marginVertical: 10,
|
||||
borderWidth: 1,
|
||||
borderColor: "#eee",
|
||||
shadowColor: "#000",
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 4,
|
||||
elevation: 1,
|
||||
},
|
||||
headerRow: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
},
|
||||
title: {
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
},
|
||||
totalCollapsed: {
|
||||
color: "#ff6600",
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
textAlign: "center",
|
||||
},
|
||||
row: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
paddingVertical: 8,
|
||||
borderBottomWidth: 0.5,
|
||||
borderBottomColor: "#eee",
|
||||
},
|
||||
tableHeader: {
|
||||
backgroundColor: "#fafafa",
|
||||
borderRadius: 6,
|
||||
marginTop: 10,
|
||||
},
|
||||
cell: {
|
||||
flex: 1,
|
||||
fontSize: 15,
|
||||
color: "#111",
|
||||
textAlign: "center",
|
||||
},
|
||||
sttCell: {
|
||||
flex: 0.3,
|
||||
fontSize: 15,
|
||||
color: "#111",
|
||||
textAlign: "center",
|
||||
paddingLeft: 10,
|
||||
},
|
||||
headerText: {
|
||||
fontWeight: "600",
|
||||
},
|
||||
statusContainer: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
statusDot: {
|
||||
width: 8,
|
||||
height: 8,
|
||||
borderRadius: 4,
|
||||
backgroundColor: "#2ecc71",
|
||||
marginRight: 6,
|
||||
},
|
||||
statusText: {
|
||||
fontSize: 15,
|
||||
color: "#4a90e2",
|
||||
textDecorationLine: "underline",
|
||||
},
|
||||
});
|
||||
@@ -1,72 +0,0 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
width: "100%",
|
||||
margin: 16,
|
||||
padding: 16,
|
||||
borderRadius: 12,
|
||||
backgroundColor: "#fff",
|
||||
shadowColor: "#000",
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 4,
|
||||
elevation: 2,
|
||||
},
|
||||
title: {
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
textAlign: "center",
|
||||
},
|
||||
row: {
|
||||
flexDirection: "row",
|
||||
borderBottomWidth: 0.5,
|
||||
borderColor: "#ddd",
|
||||
paddingVertical: 8,
|
||||
paddingLeft: 15,
|
||||
},
|
||||
cell: {
|
||||
flex: 1,
|
||||
textAlign: "center",
|
||||
fontSize: 15,
|
||||
},
|
||||
left: {
|
||||
textAlign: "left",
|
||||
},
|
||||
right: {
|
||||
color: "#ff6600",
|
||||
fontWeight: "600",
|
||||
},
|
||||
header: {
|
||||
backgroundColor: "#f8f8f8",
|
||||
borderTopWidth: 1,
|
||||
borderBottomWidth: 1,
|
||||
marginTop: 10,
|
||||
},
|
||||
headerText: {
|
||||
fontWeight: "600",
|
||||
},
|
||||
footer: {
|
||||
marginTop: 6,
|
||||
},
|
||||
footerText: {
|
||||
fontWeight: "600",
|
||||
color: "#007bff",
|
||||
},
|
||||
total: {
|
||||
color: "#ff6600",
|
||||
fontWeight: "700",
|
||||
},
|
||||
viewDetailButton: {
|
||||
marginTop: 12,
|
||||
paddingVertical: 8,
|
||||
alignItems: "center",
|
||||
},
|
||||
viewDetailText: {
|
||||
color: "#007AFF",
|
||||
fontSize: 15,
|
||||
fontWeight: "600",
|
||||
textDecorationLine: "underline",
|
||||
},
|
||||
});
|
||||
|
||||
export default styles;
|
||||
175
components/tripInfo/style/createTableStyles.ts
Normal file
175
components/tripInfo/style/createTableStyles.ts
Normal file
@@ -0,0 +1,175 @@
|
||||
import { StyleSheet } from "react-native";
|
||||
import { Colors } from "@/constants/theme";
|
||||
|
||||
export type ColorScheme = "light" | "dark";
|
||||
|
||||
export function createTableStyles(colorScheme: ColorScheme) {
|
||||
const colors = Colors[colorScheme];
|
||||
|
||||
return StyleSheet.create({
|
||||
container: {
|
||||
width: "100%",
|
||||
backgroundColor: colors.surface,
|
||||
borderRadius: 12,
|
||||
padding: 16,
|
||||
marginVertical: 10,
|
||||
borderWidth: 1,
|
||||
borderColor: colors.border,
|
||||
shadowColor: colors.text,
|
||||
shadowOpacity: 0.1,
|
||||
shadowRadius: 4,
|
||||
elevation: 2,
|
||||
},
|
||||
headerRow: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
alignItems: "center",
|
||||
},
|
||||
title: {
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
color: colors.text,
|
||||
},
|
||||
totalCollapsed: {
|
||||
color: colors.warning,
|
||||
fontSize: 18,
|
||||
fontWeight: "700",
|
||||
textAlign: "center",
|
||||
},
|
||||
row: {
|
||||
flexDirection: "row",
|
||||
justifyContent: "space-between",
|
||||
paddingVertical: 8,
|
||||
borderBottomWidth: 0.5,
|
||||
borderBottomColor: colors.separator,
|
||||
},
|
||||
header: {
|
||||
backgroundColor: colors.backgroundSecondary,
|
||||
borderRadius: 6,
|
||||
marginTop: 10,
|
||||
},
|
||||
left: {
|
||||
textAlign: "left",
|
||||
},
|
||||
rowHorizontal: {
|
||||
flexDirection: "row",
|
||||
paddingVertical: 8,
|
||||
borderBottomWidth: 0.5,
|
||||
borderBottomColor: colors.separator,
|
||||
paddingLeft: 15,
|
||||
},
|
||||
tableHeader: {
|
||||
backgroundColor: colors.backgroundSecondary,
|
||||
borderRadius: 6,
|
||||
marginTop: 10,
|
||||
},
|
||||
headerCell: {
|
||||
flex: 1,
|
||||
fontSize: 15,
|
||||
fontWeight: "600",
|
||||
color: colors.text,
|
||||
textAlign: "center",
|
||||
},
|
||||
headerCellLeft: {
|
||||
flex: 1,
|
||||
fontSize: 15,
|
||||
fontWeight: "600",
|
||||
color: colors.text,
|
||||
textAlign: "left",
|
||||
},
|
||||
cell: {
|
||||
flex: 1,
|
||||
fontSize: 15,
|
||||
color: colors.text,
|
||||
textAlign: "center",
|
||||
},
|
||||
cellLeft: {
|
||||
flex: 1,
|
||||
fontSize: 15,
|
||||
color: colors.text,
|
||||
textAlign: "left",
|
||||
},
|
||||
cellRight: {
|
||||
flex: 1,
|
||||
fontSize: 15,
|
||||
color: colors.text,
|
||||
textAlign: "right",
|
||||
},
|
||||
cellWrapper: {
|
||||
flex: 1,
|
||||
justifyContent: "center",
|
||||
alignItems: "center",
|
||||
},
|
||||
headerText: {
|
||||
fontWeight: "600",
|
||||
color: colors.text,
|
||||
},
|
||||
footerText: {
|
||||
color: colors.primary,
|
||||
fontWeight: "600",
|
||||
},
|
||||
footerTotal: {
|
||||
color: colors.warning,
|
||||
fontWeight: "800",
|
||||
},
|
||||
sttCell: {
|
||||
flex: 0.3,
|
||||
fontSize: 15,
|
||||
color: colors.text,
|
||||
textAlign: "center",
|
||||
paddingLeft: 10,
|
||||
},
|
||||
statusContainer: {
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
},
|
||||
statusDot: {
|
||||
width: 8,
|
||||
height: 8,
|
||||
borderRadius: 4,
|
||||
backgroundColor: colors.success,
|
||||
marginRight: 6,
|
||||
},
|
||||
statusDotPending: {
|
||||
width: 8,
|
||||
height: 8,
|
||||
borderRadius: 4,
|
||||
backgroundColor: colors.warning,
|
||||
marginRight: 6,
|
||||
},
|
||||
statusText: {
|
||||
fontSize: 15,
|
||||
color: colors.primary,
|
||||
textDecorationLine: "underline",
|
||||
},
|
||||
linkText: {
|
||||
color: colors.primary,
|
||||
textDecorationLine: "underline",
|
||||
},
|
||||
viewDetailButton: {
|
||||
marginTop: 12,
|
||||
paddingVertical: 8,
|
||||
alignItems: "center",
|
||||
},
|
||||
viewDetailText: {
|
||||
color: colors.primary,
|
||||
fontSize: 15,
|
||||
fontWeight: "600",
|
||||
textDecorationLine: "underline",
|
||||
},
|
||||
total: {
|
||||
color: colors.warning,
|
||||
fontWeight: "700",
|
||||
},
|
||||
right: {
|
||||
color: colors.warning,
|
||||
fontWeight: "600",
|
||||
},
|
||||
footerRow: {
|
||||
marginTop: 6,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export type TableStyles = ReturnType<typeof createTableStyles>;
|
||||
Reference in New Issue
Block a user