Admin App Information

Add:
- app-information/information-bank/

Component
Fix:
- constans-value: Icon size re name

### No Issue
This commit is contained in:
2025-08-07 12:05:16 +08:00
parent d47fff469b
commit 9ad1ccfd5f
10 changed files with 294 additions and 71 deletions

View File

@@ -0,0 +1,59 @@
import { MainColor } from "@/constants/color-palet";
import { Href, router } from "expo-router";
import { DimensionValue, TouchableOpacity } from "react-native";
type SizeType = "xs" | "sm" | "md" | "lg" | "xl" | number | string | undefined;
export default function ActionIcon({
href,
onPress,
icon,
size = "md",
}: {
href?: Href;
onPress?: () => void;
icon: React.ReactNode;
size?: SizeType;
}) {
const sizeMap = {
xs: 22,
sm: 26,
md: 30,
lg: 34,
xl: 38,
};
const getSize = (size: SizeType): DimensionValue => {
if (!size) return sizeMap.md; // Default to 'md' if size is undefined
if (typeof size === 'string' && size in sizeMap) {
return sizeMap[size as keyof typeof sizeMap];
}
return size as DimensionValue;
};
const iconSize = getSize(size);
return (
<TouchableOpacity
activeOpacity={0.7}
style={{
backgroundColor: MainColor.yellow,
padding: 5,
borderRadius: 50,
alignItems: "center",
justifyContent: "center",
width: iconSize,
height: iconSize,
}}
onPress={() => {
if (href) {
router.push(href);
} else {
onPress?.();
}
}}
>
{icon}
</TouchableOpacity>
);
}

View File

@@ -0,0 +1,13 @@
import ActionIcon from "@/components/ActionIcon/ActionIcon";
import { MainColor } from "@/constants/color-palet";
import { Ionicons } from "@expo/vector-icons";
import { router } from "expo-router";
export default function AdminBackButton() {
return (
<ActionIcon
icon={<Ionicons name="arrow-back" size={16} color={MainColor.darkblue} />}
onPress={() => router.back()}
/>
);
}

View File

@@ -0,0 +1,31 @@
import Grid from "@/components/Grid/GridCustom";
import TextCustom from "@/components/Text/TextCustom";
import { View } from "react-native";
import AdminBackButton from "./BackButton";
export default function AdminBackButtonAntTitle({
title,
}: {
title: string;
}) {
return (
<>
<Grid>
<Grid.Col span={2}>
<AdminBackButton />
</Grid.Col>
<Grid.Col
span={8}
style={{ alignItems: "center", justifyContent: "center" }}
>
<TextCustom bold size={"large"} align="center">
{title}
</TextCustom>
</Grid.Col>
<Grid.Col span={2}>
<View />
</Grid.Col>
</Grid>
</>
);
}

View File

@@ -1,6 +1,8 @@
// Alert
import AlertCustom from "./Alert/AlertCustom";
import AlertDefaultSystem from "./Alert/AlertDefaultSystem";
// ActionIcon
import ActionIcon from "./ActionIcon/ActionIcon";
// Button
import LeftButtonCustom from "./Button/BackButton";
import ButtonCenteredOnly from "./Button/ButtonCenteredOnly";
@@ -60,6 +62,9 @@ import GridComponentView from "./_ShareComponent/GridSectionView";
import ProgressCustom from "./Progress/ProgressCustom";
export {
// ActionIcon
ActionIcon,
// Alert
AlertCustom,
AlertDefaultSystem,
// Image