diff --git a/mobile/app/(app)/(tabs)/_layout.tsx b/mobile/app/(app)/(tabs)/_layout.tsx index b139193a5..3d3abc331 100644 --- a/mobile/app/(app)/(tabs)/_layout.tsx +++ b/mobile/app/(app)/(tabs)/_layout.tsx @@ -1,13 +1,9 @@ import React from "react"; import { Tabs } from "expo-router"; -import ObservationSVG from "../../../assets/icons/observation.svg"; -import QuickReportSVG from "../../../assets/icons/quick-report.svg"; -import GuidesSVG from "../../../assets/icons/Learning.svg"; -import InboxSVG from "../../../assets/icons/Inbox.svg"; -import MoreSVG from "../../../assets/icons/More.svg"; import { TextStyle, ViewStyle } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useTheme } from "tamagui"; +import { Icon } from "../../../components/Icon"; export default function TabLayout() { const insets = useSafeAreaInsets(); @@ -27,35 +23,35 @@ export default function TabLayout() { name="index" options={{ title: "Observation", - tabBarIcon: ({ color }) => , + tabBarIcon: ({ color }) => , }} /> , + tabBarIcon: ({ color }) => , }} /> , + tabBarIcon: ({ color }) => , }} /> , + tabBarIcon: ({ color }) => , }} /> , + tabBarIcon: ({ color }) => , }} /> diff --git a/mobile/app/(app)/(tabs)/index.tsx b/mobile/app/(app)/(tabs)/index.tsx index affbf68a9..afb2d3571 100644 --- a/mobile/app/(app)/(tabs)/index.tsx +++ b/mobile/app/(app)/(tabs)/index.tsx @@ -1,6 +1,7 @@ import { View, Text } from "react-native"; import { useAuth } from "../../../hooks/useAuth"; import OfflinePersistComponentExample from "../../../components/OfflinePersistComponentExample"; +import { Icon } from "../../../components/Icon"; const Index = () => { const { signOut } = useAuth(); @@ -8,6 +9,12 @@ const Index = () => { return ( Observation + Logout diff --git a/mobile/assets/icons/adaptive-icon.png b/mobile/assets/icons/adaptive-icon.png deleted file mode 100644 index 03d6f6b6c..000000000 Binary files a/mobile/assets/icons/adaptive-icon.png and /dev/null differ diff --git a/mobile/components/Icon.tsx b/mobile/components/Icon.tsx new file mode 100644 index 000000000..40d5411f9 --- /dev/null +++ b/mobile/components/Icon.tsx @@ -0,0 +1,163 @@ +import * as React from "react"; +import EyeOff from "../assets/icons/Eye off.svg"; +import Eye from "../assets/icons/Eye.svg"; +import Observation from "../assets/icons/observation.svg"; +import QuickReport from "../assets/icons/quick-report.svg"; +import Learning from "../assets/icons/Learning.svg"; +import Inbox from "../assets/icons/Inbox.svg"; +import More from "../assets/icons/More.svg"; +import ChevronRight from "../assets/icons/Chevron right.svg"; +import ChevronLeft from "../assets/icons/Chevron left.svg"; +import AddNote from "../assets/icons/add-note.svg"; +import Trash from "../assets/icons/Trash.svg"; +import Logout from "../assets/icons/logout.svg"; +import PencilAlt from "../assets/icons/Pencil alt.svg"; +import XCircle from "../assets/icons/x-circle.svg"; +import MenuAlt2 from "../assets/icons/menu-alt-2.svg"; +import DotsVertical from "../assets/icons/dots-vertical.svg"; + +import { styled } from "tamagui"; +import { View } from "tamagui"; +import { StyleProp, ViewStyle } from "react-native"; + +interface IconProps { + /** + * The name of the icon + */ + icon: string; + + /** + * An optional tint color for the icon + */ + color?: string; + + /** + * An optional size for the icon. If not provided, the icon will be sized to the icon's resolution. + */ + size?: number; + + /** + * Style overrides for the view container + */ + style?: StyleProp; +} + +/** + * A component to render a registered icon. + * It is wrapped in a if `onPress` is provided, otherwise a . + * @see [Documentation and Examples]{@link https://docs.infinite.red/ignite-cli/boilerplate/components/Icon/} + * @param {IconProps} props - The props for the `Icon` component. + * @returns {JSX.Element} The rendered `Icon` component. + */ + +type IconRegistry = { + [key: string]: React.ReactNode; +}; + +export const defaultIcon = (props: IconProps) => { + const { + icon, + color, + size, + style: $viewStyleOverride, + ...tamaguiProps + } = props; + + const iconRegistry: IconRegistry = { + eyeOff: ( + + ), + eye: , + observation: ( + + ), + + quickReport: ( + + ), + learning: ( + + ), + inbox: ( + + ), + more: ( + + ), + chevronRight: ( + + ), + chevronLeft: ( + + ), + addNote: ( + + ), + trash: ( + + ), + logout: ( + + ), + pencilAlt: ( + + ), + xCircle: ( + + ), + menuAlt2: ( + + ), + dotsVertical: ( + + ), + }; + + return ( + + {iconRegistry[icon]} + + ); +}; + +export const Icon = styled( + defaultIcon, + {}, + { + accept: { + color: "color", + }, + } +);