Skip to content

Commit 23edbc9

Browse files
committed
refactor: update ui folder to components/ui
1 parent 5b2933e commit 23edbc9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+100
-80
lines changed

Diff for: docs/src/content/docs/ui-and-theme/Forms.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import React from 'react';
5757
import { useForm } from 'react-hook-form';
5858
import * as z from 'zod';
5959

60-
import { useAuth } from '@/core';
60+
import { useAuth } from '@/lib';
6161
import { Button, ControlledInput, View } from '@/ui';
6262

6363
const schema = z.object({

Diff for: src/app/(app)/_layout.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
import { Link, Redirect, SplashScreen, Tabs } from 'expo-router';
33
import React, { useCallback, useEffect } from 'react';
44

5-
import { useAuth, useIsFirstTime } from '@/core';
6-
import { Pressable, Text } from '@/ui';
5+
import { Pressable, Text } from '@/components/ui';
76
import {
87
Feed as FeedIcon,
98
Settings as SettingsIcon,
109
Style as StyleIcon,
11-
} from '@/ui/icons';
10+
} from '@/components/ui/icons';
11+
import { useAuth, useIsFirstTime } from '@/lib';
1212

1313
export default function TabLayout() {
1414
const status = useAuth.use.status();
@@ -68,7 +68,7 @@ const CreateNewPostLink = () => {
6868
return (
6969
<Link href="/feed/add-post" asChild>
7070
<Pressable>
71-
<Text className="px-3 text-primary-300">Create</Text>
71+
<Text className="text-primary-300 px-3">Create</Text>
7272
</Pressable>
7373
</Link>
7474
);

Diff for: src/app/(app)/index.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import React from 'react';
44
import type { Post } from '@/api';
55
import { usePosts } from '@/api';
66
import { Card } from '@/components/card';
7-
import { EmptyList, FocusAwareStatusBar, Text, View } from '@/ui';
7+
import { EmptyList, FocusAwareStatusBar, Text, View } from '@/components/ui';
88

99
export default function Feed() {
1010
const { data, isPending, isError } = usePosts();
1111
const renderItem = React.useCallback(
1212
({ item }: { item: Post }) => <Card {...item} />,
13-
[]
13+
[],
1414
);
1515

1616
if (isError) {

Diff for: src/app/(app)/settings.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ import { Item } from '@/components/settings/item';
66
import { ItemsContainer } from '@/components/settings/items-container';
77
import { LanguageItem } from '@/components/settings/language-item';
88
import { ThemeItem } from '@/components/settings/theme-item';
9-
import { translate, useAuth } from '@/core';
10-
import { colors, FocusAwareStatusBar, ScrollView, Text, View } from '@/ui';
11-
import { Github, Rate, Share, Support, Website } from '@/ui/icons';
9+
import {
10+
colors,
11+
FocusAwareStatusBar,
12+
ScrollView,
13+
Text,
14+
View,
15+
} from '@/components/ui';
16+
import { Github, Rate, Share, Support, Website } from '@/components/ui/icons';
17+
import { translate, useAuth } from '@/lib';
1218

1319
export default function Settings() {
1420
const signOut = useAuth.use.signOut();

Diff for: src/app/(app)/style.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Buttons } from '@/components/buttons';
44
import { Colors } from '@/components/colors';
55
import { Inputs } from '@/components/inputs';
66
import { Typography } from '@/components/typography';
7-
import { FocusAwareStatusBar, SafeAreaView, ScrollView } from '@/ui';
7+
import { FocusAwareStatusBar, SafeAreaView, ScrollView } from '@/components/ui';
88

99
export default function Style() {
1010
return (

Diff for: src/app/[...messing].tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Link, Stack } from 'expo-router';
22

3-
import { Text, View } from '@/ui';
3+
import { Text, View } from '@/components/ui';
44

55
export default function NotFoundScreen() {
66
return (

Diff for: src/app/_layout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import { GestureHandlerRootView } from 'react-native-gesture-handler';
1111
import { KeyboardProvider } from 'react-native-keyboard-controller';
1212

1313
import { APIProvider } from '@/api';
14-
import { hydrateAuth, loadSelectedTheme } from '@/core';
15-
import { useThemeConfig } from '@/core/use-theme-config';
14+
import { hydrateAuth, loadSelectedTheme } from '@/lib';
15+
import { useThemeConfig } from '@/lib/use-theme-config';
1616

1717
export { ErrorBoundary } from 'expo-router';
1818

Diff for: src/app/feed/[id].tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { Stack, useLocalSearchParams } from 'expo-router';
22
import * as React from 'react';
33

44
import { usePost } from '@/api';
5-
import { ActivityIndicator, FocusAwareStatusBar, Text, View } from '@/ui';
5+
import {
6+
ActivityIndicator,
7+
FocusAwareStatusBar,
8+
Text,
9+
View,
10+
} from '@/components/ui';
611

712
export default function Post() {
813
const local = useLocalSearchParams<{ id: string }>();

Diff for: src/app/feed/add-post.tsx

+7-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ import { showMessage } from 'react-native-flash-message';
66
import { z } from 'zod';
77

88
import { useAddPost } from '@/api';
9-
import { Button, ControlledInput, showErrorMessage, View } from '@/ui';
9+
import {
10+
Button,
11+
ControlledInput,
12+
showErrorMessage,
13+
View,
14+
} from '@/components/ui';
1015

1116
const schema = z.object({
1217
title: z.string().min(10),
@@ -37,7 +42,7 @@ export default function AddPost() {
3742
onError: () => {
3843
showErrorMessage('Error adding post');
3944
},
40-
}
45+
},
4146
);
4247
};
4348
return (

Diff for: src/app/login.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import React from 'react';
33

44
import type { LoginFormProps } from '@/components/login-form';
55
import { LoginForm } from '@/components/login-form';
6-
import { useAuth } from '@/core';
7-
import { FocusAwareStatusBar } from '@/ui';
6+
import { FocusAwareStatusBar } from '@/components/ui';
7+
import { useAuth } from '@/lib';
88

99
export default function Login() {
1010
const router = useRouter();

Diff for: src/app/onboarding.tsx

+8-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@ import { useRouter } from 'expo-router';
22
import React from 'react';
33

44
import { Cover } from '@/components/cover';
5-
import { useIsFirstTime } from '@/core/hooks';
6-
import { Button, FocusAwareStatusBar, SafeAreaView, Text, View } from '@/ui';
5+
import {
6+
Button,
7+
FocusAwareStatusBar,
8+
SafeAreaView,
9+
Text,
10+
View,
11+
} from '@/components/ui';
12+
import { useIsFirstTime } from '@/lib/hooks';
713
export default function Onboarding() {
814
const [_, setIsFirstTime] = useIsFirstTime();
915
const router = useRouter();

Diff for: src/components/buttons.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { Button, View } from '@/ui';
3+
import { Button, View } from '@/components/ui';
44

55
import { Title } from './title';
66

Diff for: src/components/card.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Link } from 'expo-router';
22
import React from 'react';
33

44
import type { Post } from '@/api';
5-
import { Image, Pressable, Text, View } from '@/ui';
5+
import { Image, Pressable, Text, View } from '@/components/ui';
66

77
type Props = Post;
88

Diff for: src/components/colors.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22

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

66
import { Title } from './title';
77
type ColorName = keyof typeof colors;

Diff for: src/components/inputs.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import React from 'react';
22

3-
import type { OptionType } from '@/ui';
4-
import { Input, Select, View } from '@/ui';
5-
import { Checkbox, Radio, Switch } from '@/ui';
3+
import type { OptionType } from '@/components/ui';
4+
import { Input, Select, View } from '@/components/ui';
5+
import { Checkbox, Radio, Switch } from '@/components/ui';
66

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

Diff for: src/components/login-form.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { cleanup, screen, setup, waitFor } from '@/core/test-utils';
3+
import { cleanup, screen, setup, waitFor } from '@/lib/test-utils';
44

55
import type { LoginFormProps } from './login-form';
66
import { LoginForm } from './login-form';

Diff for: src/components/login-form.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { useForm } from 'react-hook-form';
55
import { KeyboardAvoidingView } from 'react-native-keyboard-controller';
66
import * as z from 'zod';
77

8-
import { Button, ControlledInput, Text, View } from '@/ui';
8+
import { Button, ControlledInput, Text, View } from '@/components/ui';
99

1010
const schema = z.object({
1111
name: z.string().optional(),

Diff for: src/components/settings/item.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import * as React from 'react';
22

3-
import type { TxKeyPath } from '@/core';
4-
import { Pressable, Text, View } from '@/ui';
5-
import { ArrowRight } from '@/ui/icons';
3+
import { Pressable, Text, View } from '@/components/ui';
4+
import { ArrowRight } from '@/components/ui/icons';
5+
import type { TxKeyPath } from '@/lib';
66

77
type ItemProps = {
88
text: TxKeyPath;

Diff for: src/components/settings/items-container.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
22

3-
import type { TxKeyPath } from '@/core';
4-
import { Text, View } from '@/ui';
3+
import { Text, View } from '@/components/ui';
4+
import type { TxKeyPath } from '@/lib';
55

66
type Props = {
77
children: React.ReactNode;

Diff for: src/components/settings/language-item.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import * as React from 'react';
22

3-
import { useSelectedLanguage } from '@/core';
4-
import { translate } from '@/core';
5-
import type { Language } from '@/core/i18n/resources';
6-
import type { OptionType } from '@/ui';
7-
import { Options, useModal } from '@/ui';
3+
import type { OptionType } from '@/components/ui';
4+
import { Options, useModal } from '@/components/ui';
5+
import { useSelectedLanguage } from '@/lib';
6+
import { translate } from '@/lib';
7+
import type { Language } from '@/lib/i18n/resources';
88

99
import { Item } from './item';
1010

@@ -16,20 +16,20 @@ export const LanguageItem = () => {
1616
setLanguage(option.value as Language);
1717
modal.dismiss();
1818
},
19-
[setLanguage, modal]
19+
[setLanguage, modal],
2020
);
2121

2222
const langs = React.useMemo(
2323
() => [
2424
{ label: translate('settings.english'), value: 'en' },
2525
{ label: translate('settings.arabic'), value: 'ar' },
2626
],
27-
[]
27+
[],
2828
);
2929

3030
const selectedLanguage = React.useMemo(
3131
() => langs.find((lang) => lang.value === language),
32-
[language, langs]
32+
[language, langs],
3333
);
3434

3535
return (

Diff for: src/components/settings/theme-item.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
22

3-
import type { ColorSchemeType } from '@/core';
4-
import { translate, useSelectedTheme } from '@/core';
5-
import type { OptionType } from '@/ui';
6-
import { Options, useModal } from '@/ui';
3+
import type { OptionType } from '@/components/ui';
4+
import { Options, useModal } from '@/components/ui';
5+
import type { ColorSchemeType } from '@/lib';
6+
import { translate, useSelectedTheme } from '@/lib';
77

88
import { Item } from './item';
99

@@ -16,7 +16,7 @@ export const ThemeItem = () => {
1616
setSelectedTheme(option.value as ColorSchemeType);
1717
modal.dismiss();
1818
},
19-
[setSelectedTheme, modal]
19+
[setSelectedTheme, modal],
2020
);
2121

2222
const themes = React.useMemo(
@@ -25,12 +25,12 @@ export const ThemeItem = () => {
2525
{ label: `${translate('settings.theme.light')} 🌞`, value: 'light' },
2626
{ label: `${translate('settings.theme.system')} ⚙️`, value: 'system' },
2727
],
28-
[]
28+
[],
2929
);
3030

3131
const theme = React.useMemo(
3232
() => themes.find((t) => t.value === selectedTheme),
33-
[selectedTheme, themes]
33+
[selectedTheme, themes],
3434
);
3535

3636
return (

Diff for: src/components/title.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
import { Text, View } from '@/ui';
3+
import { Text, View } from '@/components/ui';
44

55
type Props = {
66
text: string;

Diff for: src/components/typography.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22

3-
import { Text, View } from '@/ui';
3+
import { Text, View } from '@/components/ui';
44

55
import { Title } from './title';
66

Diff for: src/ui/button.test.tsx renamed to src/components/ui/button.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React from 'react';
33
import { Text } from 'react-native';
44

5-
import { cleanup, render, screen, setup } from '@/core/test-utils';
5+
import { cleanup, render, screen, setup } from '@/lib/test-utils';
66

77
import { Button } from './button';
88

Diff for: src/ui/button.tsx renamed to src/components/ui/button.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const button = tv({
5858
label: 'text-sm',
5959
indicator: 'h-2',
6060
},
61-
icon: { container: 'h-9 w-9' },
61+
icon: { container: 'size-9' },
6262
},
6363
disabled: {
6464
true: {
@@ -105,11 +105,11 @@ export const Button = React.forwardRef<View, Props>(
105105
textClassName = '',
106106
...props
107107
},
108-
ref
108+
ref,
109109
) => {
110110
const styles = React.useMemo(
111111
() => button({ variant, disabled, size }),
112-
[variant, disabled, size]
112+
[variant, disabled, size],
113113
);
114114

115115
return (
@@ -142,5 +142,5 @@ export const Button = React.forwardRef<View, Props>(
142142
)}
143143
</Pressable>
144144
);
145-
}
145+
},
146146
);

Diff for: src/ui/checkbox.test.tsx renamed to src/components/ui/checkbox.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'react-native';
33

44
import React from 'react';
55

6-
import { cleanup, screen, setup } from '@/core/test-utils';
6+
import { cleanup, screen, setup } from '@/lib/test-utils';
77

88
import { Checkbox, Radio, Switch } from './checkbox';
99

0 commit comments

Comments
 (0)