Skip to content

Commit c257f7a

Browse files
committed
fix sonarqube
1 parent 5668dad commit c257f7a

File tree

8 files changed

+55
-81
lines changed

8 files changed

+55
-81
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Text } from '@baseapp-frontend/design-system/components/native/typographies'
2+
import { View } from '@baseapp-frontend/design-system/components/native/views'
3+
import { useTheme } from '@baseapp-frontend/design-system/providers/native'
4+
5+
import { createStyles } from './styles'
6+
import { EmptyViewProps } from './types'
7+
8+
const EmptyView = ({ icon, title, message }: EmptyViewProps) => {
9+
const theme = useTheme()
10+
const styles = createStyles(theme)
11+
12+
return (
13+
<View style={styles.container}>
14+
{icon && <View style={styles.imageWrapper}>{icon}</View>}
15+
<View style={styles.textWrapper}>
16+
{title && (
17+
<Text variant="subtitle2" style={styles.text}>
18+
{title}
19+
</Text>
20+
)}
21+
{message && (
22+
<Text variant="caption" style={styles.text}>
23+
{message}
24+
</Text>
25+
)}
26+
</View>
27+
</View>
28+
)
29+
}
30+
31+
export default EmptyView
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { ReactNode } from 'react'
2+
3+
import { StyleProp, ViewStyle } from 'react-native'
4+
5+
export interface EmptyViewProps {
6+
icon?: ReactNode
7+
title: string
8+
message?: string
9+
style?: StyleProp<ViewStyle>
10+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as EmptyView } from './EmptyView'
2+
export type * from './EmptyView/types'
Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
11
import { SocialMediaDiscussionImage } from '@baseapp-frontend/design-system/components/native/illustrations'
2-
import { Text } from '@baseapp-frontend/design-system/components/native/typographies'
3-
import { View } from '@baseapp-frontend/design-system/components/native/views'
4-
import { useTheme } from '@baseapp-frontend/design-system/providers/native'
52

6-
import { createStyles } from './styles'
3+
import { EmptyView } from '../../../../__shared__/native'
74

8-
const EmptyChatRoomsState = () => {
9-
const theme = useTheme()
10-
const styles = createStyles(theme)
11-
12-
return (
13-
<View style={styles.container}>
14-
<View style={styles.imageWrapper}>
15-
<SocialMediaDiscussionImage />
16-
</View>
17-
<View style={styles.textWrapper}>
18-
<Text variant="subtitle2" style={styles.text}>
19-
No messages to be displayed.
20-
</Text>
21-
</View>
22-
</View>
23-
)
24-
}
5+
const EmptyChatRoomsState = () => (
6+
<EmptyView icon={<SocialMediaDiscussionImage />} title="No messages to be displayed." />
7+
)
258

269
export default EmptyChatRoomsState
Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,13 @@
11
import { SearchingImage } from '@baseapp-frontend/design-system/components/native/illustrations'
2-
import { Text } from '@baseapp-frontend/design-system/components/native/typographies'
3-
import { View } from '@baseapp-frontend/design-system/components/native/views'
4-
import { useTheme } from '@baseapp-frontend/design-system/providers/native'
52

6-
import { createStyles } from './styles'
7-
import { SearchNotFoundStateProps } from './types'
3+
import { EmptyView } from '../../../__shared__/native'
84

9-
const SearchNotFoundState = ({
10-
message = 'Check your spelling or try another search.',
11-
}: SearchNotFoundStateProps) => {
12-
const theme = useTheme()
13-
const styles = createStyles(theme)
14-
15-
return (
16-
<View style={styles.container}>
17-
<View style={styles.imageWrapper}>
18-
<SearchingImage />
19-
</View>
20-
<View style={styles.textWrapper}>
21-
<Text variant="subtitle2" style={styles.text}>
22-
No results found
23-
</Text>
24-
<Text variant="caption" style={styles.text}>
25-
{message}
26-
</Text>
27-
</View>
28-
</View>
29-
)
30-
}
5+
const SearchNotFoundState = () => (
6+
<EmptyView
7+
icon={<SearchingImage />}
8+
title="No results found"
9+
message="Check your spelling or try another search."
10+
/>
11+
)
3112

3213
export default SearchNotFoundState

packages/components/modules/messages/native/SearchNotFoundState/styles.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

packages/components/modules/messages/native/SearchNotFoundState/types.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)