Skip to content

Commit 2dd061c

Browse files
committed
refactor(ui): refactor ui components
1 parent 9a8c98b commit 2dd061c

36 files changed

+97
-157
lines changed

ios/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ EXTERNAL SOURCES:
14731473

14741474
SPEC CHECKSUMS:
14751475
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
1476-
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
1476+
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
14771477
EXConstants: 988aa430ca0f76b43cd46b66e7fae3287f9cc2fc
14781478
EXFont: f20669cb266ef48b004f1eb1f2b20db96cd1df9f
14791479
EXJSONUtils: 5c42959e87be238b045ef37cc5268b16a6c0ad4a
@@ -1495,7 +1495,7 @@ SPEC CHECKSUMS:
14951495
FBLazyVector: 84f6edbe225f38aebd9deaf1540a4160b1f087d7
14961496
FBReactNativeSpec: d0086a479be91c44ce4687a962956a352d2dc697
14971497
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
1498-
glog: c5d68082e772fa1c511173d6b30a9de2c05a69a2
1498+
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
14991499
hermes-engine: b2669ce35fc4ac14f523b307aff8896799829fe2
15001500
libaom: 144606b1da4b5915a1054383c3a4459ccdb3c661
15011501
libavif: 84bbb62fb232c3018d6f1bab79beea87e35de7b7
@@ -1559,7 +1559,7 @@ SPEC CHECKSUMS:
15591559
SDWebImageSVGCoder: 15a300a97ec1c8ac958f009c02220ac0402e936c
15601560
SDWebImageWebPCoder: af09429398d99d524cae2fe00f6f0f6e491ed102
15611561
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
1562-
Yoga: 64cd2a583ead952b0315d5135bf39e053ae9be70
1562+
Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312
15631563

15641564
PODFILE CHECKSUM: ac55d8c0b92af1b0a5da5f8cb8448313ecc7948e
15651565

src/app/(app)/_layout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { Link, Redirect, SplashScreen, Tabs } from 'expo-router';
33
import React, { useCallback, useEffect } from 'react';
44

55
import { useAuth, useIsFirstTime } from '@/core';
6+
import { Pressable, Text } from '@/ui';
67
import {
78
Feed as FeedIcon,
8-
Pressable,
99
Settings as SettingsIcon,
1010
Style as StyleIcon,
11-
Text,
12-
} from '@/ui';
11+
} from '@/ui/icons';
1312

1413
export default function TabLayout() {
1514
const status = useAuth.use.status();

src/app/(app)/settings.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,8 @@ import { ItemsContainer } from '@/components/settings/items-container';
77
import { LanguageItem } from '@/components/settings/language-item';
88
import { ThemeItem } from '@/components/settings/theme-item';
99
import { translate, useAuth } from '@/core';
10-
import {
11-
colors,
12-
FocusAwareStatusBar,
13-
Github,
14-
Rate,
15-
ScrollView,
16-
Share,
17-
Support,
18-
Text,
19-
View,
20-
Website,
21-
} from '@/ui';
10+
import { colors, FocusAwareStatusBar, ScrollView, Text, View } from '@/ui';
11+
import { Github, Rate, Share, Support, Website } from '@/ui/icons';
2212

2313
export default function Settings() {
2414
const signOut = useAuth.use.signOut();

src/components/card.tsx

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,29 @@ import { Image, Pressable, Text, View } from '@/ui';
66

77
type Props = Post;
88

9+
const images = [
10+
'https://images.unsplash.com/photo-1489749798305-4fea3ae63d43?auto=format&fit=crop&w=800&q=80',
11+
'https://images.unsplash.com/photo-1564507004663-b6dfb3c824d5?auto=format&fit=crop&w=800&q=80',
12+
'https://images.unsplash.com/photo-1515386474292-47555758ef2e?auto=format&fit=crop&w=800&q=80',
13+
'https://plus.unsplash.com/premium_photo-1666815503002-5f07a44ac8fb?auto=format&fit=crop&w=800&q=80',
14+
'https://images.unsplash.com/photo-1587974928442-77dc3e0dba72?auto=format&fit=crop&w=800&q=80',
15+
];
16+
917
export const Card = ({ title, body, id }: Props) => {
1018
return (
1119
<Link href={`/feed/${id}`} asChild>
12-
<Pressable className="m-2 overflow-hidden rounded-xl bg-neutral-200 p-2 shadow-xl dark:bg-charcoal-900">
20+
<Pressable className="m-2 overflow-hidden rounded-xl border border-neutral-300 bg-white dark:bg-neutral-900">
1321
<Image
14-
className="h-56 w-full"
22+
className="h-56 w-full overflow-hidden rounded-t-xl"
1523
contentFit="cover"
1624
source={{
17-
uri: 'https://images.unsplash.com/photo-1524758631624-e2822e304c36?ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=2070&q=80',
25+
uri: images[Math.floor(Math.random() * images.length)],
1826
}}
1927
/>
2028

21-
<View>
22-
<Text className="py-2 text-2xl font-bold">{title}</Text>
23-
<Text numberOfLines={3} className="leading-snug">
29+
<View className="p-2">
30+
<Text className="py-3 text-2xl ">{title}</Text>
31+
<Text numberOfLines={3} className="leading-snug text-gray-600">
2432
{body}
2533
</Text>
2634
</View>

src/components/colors.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22

33
import { Text, View } from '@/ui';
4-
import colors from '@/ui/theme/colors';
4+
import colors from '@/ui/colors';
55

66
import { Title } from './title';
77
type ColorName = keyof typeof colors;
@@ -39,9 +39,9 @@ const Color = ({ name }: { name: ColorName }) => {
3939

4040
const ColorCard = ({ color, value }: { value: string; color: string }) => {
4141
return (
42-
<View>
42+
<View className="flex-1">
4343
<View
44-
className="h-14 w-8 rounded-sm"
44+
className="h-14 w-full rounded-sm"
4545
style={{ backgroundColor: color }}
4646
/>
4747
<Text className="text-sm">{value}</Text>

src/components/inputs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22

33
import type { Option } from '@/ui';
44
import { Input, Select, View } from '@/ui';
5-
import { Checkbox, Radio, Switch } from '@/ui/core/checkbox';
5+
import { Checkbox, Radio, Switch } from '@/ui/checkbox';
66

77
import { Title } from './title';
88

src/components/settings/item.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import * as React from 'react';
22

33
import type { TxKeyPath } from '@/core';
4-
import { ArrowRight, Pressable, Text, View } from '@/ui';
4+
import { Pressable, Text, View } from '@/ui';
5+
import { ArrowRight } from '@/ui/icons';
56

67
type ItemProps = {
78
text: TxKeyPath;

src/components/settings/items-container.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const ItemsContainer = ({ children, title }: Props) => {
1313
<>
1414
{title && <Text className="pb-2 pt-4 text-lg" tx={title} />}
1515
{
16-
<View className=" rounded-md border-[1px] border-neutral-200 dark:border-charcoal-700 dark:bg-charcoal-800">
16+
<View className=" rounded-md border-[1px] border-neutral-200 dark:border-neutral-700 dark:bg-neutral-800">
1717
{children}
1818
</View>
1919
}

src/core/use-theme-config.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
} from '@react-navigation/native';
66
import { useColorScheme } from 'nativewind';
77

8-
import { colors } from '@/ui/theme';
8+
import colors from '@/ui/colors';
99

1010
const DarkTheme: Theme = {
1111
..._DarkTheme,

src/ui/core/button.tsx renamed to src/ui/button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const button = tv({
2424
},
2525
outline: {
2626
container: 'border border-neutral-400',
27-
label: 'text-black dark:text-charcoal-100',
27+
label: 'text-black dark:text-neutral-100',
2828
indicator: 'text-black',
2929
},
3030
destructive: {

0 commit comments

Comments
 (0)