Skip to content

Commit

Permalink
refactor: use config for colors
Browse files Browse the repository at this point in the history
  • Loading branch information
mrevanzak committed Oct 29, 2023
1 parent 229df44 commit 01da3ce
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
11 changes: 6 additions & 5 deletions apps/expo/src/app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React from "react";
import { Button } from "react-native-ui-lib";
import { Button, Colors } from "react-native-ui-lib";
import { Tabs } from "expo-router";
import Ionicons from "@expo/vector-icons/Ionicons";
import { colors } from "@/utils/constant";

export default function TabsLayout() {
return (
Expand All @@ -10,7 +11,7 @@ export default function TabsLayout() {
screenOptions={{
tabBarShowLabel: false,
tabBarStyle: {
backgroundColor: "#157DC1",
backgroundColor: colors.primary,
borderTopLeftRadius: 15,
borderTopRightRadius: 15,
height: 70,
Expand Down Expand Up @@ -39,7 +40,7 @@ export default function TabsLayout() {
tabBarItemStyle: {
top: -35,
borderRadius: 120,
backgroundColor: "white",
backgroundColor: Colors.white,
aspectRatio: 1,
},
tabBarIconStyle: {
Expand All @@ -58,7 +59,7 @@ export default function TabsLayout() {
: "md-checkmark-circle"
}
size={70}
color="#FDBC12"
color={colors.secondary}
/>
</Button>
),
Expand All @@ -74,7 +75,7 @@ export default function TabsLayout() {
<Ionicons
name={focused ? "md-person" : "md-person-outline"}
size={32}
color="white"
color={Colors.white}
/>
),
}}
Expand Down
9 changes: 5 additions & 4 deletions apps/expo/src/app/index.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
import type { ImageSourcePropType } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { Button, Image, View } from "react-native-ui-lib";
import { Button, Image, Colors, View } from "react-native-ui-lib";
import { LinearGradient } from "expo-linear-gradient";
import { Link } from "expo-router";

import Logo from "~/full-logo.png";
import { colors } from "@/utils/constant";

export default function WelcomeScreen() {
return (
<SafeAreaView className="flex-1">
<LinearGradient
colors={["#157DC1", "#FFFFFF"]}
colors={[colors.primary, Colors.white]}
locations={[0.17, 0.64]}
className="flex-1"
>
<View flex center>
<Image source={Logo as ImageSourcePropType} className="" />
<Image source={Logo as ImageSourcePropType} />
</View>
<View flex centerH>
<Link replace href="/(tabs)/home" asChild>
<Button
label="Login"
size="medium"
backgroundColor="#157DC1"
bg-primary
className="w-1/2 p-3"
/>
</Link>
Expand Down
1 change: 0 additions & 1 deletion apps/expo/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export default function Header(
/>
</Button>
</Link>
{/* </View> */}
</SafeAreaView>
);
}
2 changes: 1 addition & 1 deletion apps/expo/src/utils/constant.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Colors } from "react-native-ui-lib";

const colors = {
export const colors = {
primary: "#157DC1",
secondary: "#FDBC12",
} as const;
Expand Down
9 changes: 9 additions & 0 deletions apps/expo/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { colors } from "@/utils/constant";
import type { Config } from "tailwindcss";

import baseConfig from "@vivat/tailwind-config";

export default {
content: ["./src/**/*.{ts,tsx}"],
presets: [baseConfig],
theme: {
extend: {
colors: {
primary: colors.primary,
secondary: colors.secondary,
},
},
},
} satisfies Config;

0 comments on commit 01da3ce

Please sign in to comment.