-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
212 changed files
with
152,445 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
yarn-path ".yarn/releases/yarn-1.19.0.cjs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const prettier = require('prettier'); | ||
|
||
const ignorePatterns = /bundle-icons\.js|\.DS_Store|index\.ts|@2x|@3x/; | ||
const requireBasePath = './'; | ||
const iconPath = path.join(__dirname, 'icon'); | ||
const icons = {}; | ||
|
||
fs.readdirSync(iconPath).forEach((filename) => { | ||
if (filename.match(ignorePatterns)) return; | ||
const ext = path.extname(filename); | ||
const name = filename.replace(ext, '').replace(/icon-|ic-/g, ''); | ||
const assetPath = requireBasePath + filename; | ||
icons[name] = `require('${assetPath}')`; | ||
}); | ||
|
||
const serializedIcons = JSON.stringify(icons, null, 4).replace( | ||
/("require\()('.+')(\)")/g, | ||
(_, a, b, c) => a.replace('"', '') + b + c.replace('"', ''), | ||
); | ||
const exportString = `const SBIconAssets = ${serializedIcons}; export default SBIconAssets`; | ||
|
||
fs.writeFileSync( | ||
path.join(iconPath, 'index.ts'), | ||
prettier.format(exportString, { | ||
'printWidth': 120, | ||
'tabWidth': 2, | ||
'useTabs': false, | ||
'semi': true, | ||
'singleQuote': true, | ||
'quoteProps': 'preserve', | ||
'trailingComma': 'all', | ||
'bracketSpacing': true, | ||
'arrowParens': 'always', | ||
}), | ||
); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+1018 Bytes
packages/uikit-react-native/src/assets/icon/icon-chevron-down@2x.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+988 Bytes
packages/uikit-react-native/src/assets/icon/icon-chevron-right@2x.png
Oops, something went wrong.
Binary file added
BIN
+1.65 KB
packages/uikit-react-native/src/assets/icon/icon-chevron-right@3x.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+3.03 KB
packages/uikit-react-native/src/assets/icon/icon-file-document@3x.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+900 Bytes
packages/uikit-react-native/src/assets/icon/icon-notifications-filled.png
Oops, something went wrong.
Binary file added
BIN
+1.88 KB
packages/uikit-react-native/src/assets/icon/icon-notifications-filled@2x.png
Oops, something went wrong.
Binary file added
BIN
+2.91 KB
packages/uikit-react-native/src/assets/icon/icon-notifications-filled@3x.png
Oops, something went wrong.
Binary file added
BIN
+1.04 KB
packages/uikit-react-native/src/assets/icon/icon-notifications-off-filled.png
Oops, something went wrong.
Binary file added
BIN
+2.13 KB
packages/uikit-react-native/src/assets/icon/icon-notifications-off-filled@2x.png
Oops, something went wrong.
Binary file added
BIN
+3.35 KB
packages/uikit-react-native/src/assets/icon/icon-notifications-off-filled@3x.png
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+2.21 KB
packages/uikit-react-native/src/assets/icon/icon-notifications@2x.png
Oops, something went wrong.
Binary file added
BIN
+3.56 KB
packages/uikit-react-native/src/assets/icon/icon-notifications@3x.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+2.86 KB
packages/uikit-react-native/src/assets/icon/icon-settings-filled@2x.png
Oops, something went wrong.
Binary file added
BIN
+4.56 KB
packages/uikit-react-native/src/assets/icon/icon-settings-filled@3x.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Binary file added
BIN
+2.77 KB
packages/uikit-react-native/src/assets/icon/icon-thumbnail-none@2x.png
Oops, something went wrong.
Binary file added
BIN
+4.41 KB
packages/uikit-react-native/src/assets/icon/icon-thumbnail-none@3x.png
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
const SBIconAssets = { | ||
'chat-hide': require('./ic-chat-hide.png'), | ||
'chat-show': require('./ic-chat-show.png'), | ||
'add': require('./icon-add.png'), | ||
'archive': require('./icon-archive.png'), | ||
'arrow-left': require('./icon-arrow-left.png'), | ||
'ban': require('./icon-ban.png'), | ||
'broadcast': require('./icon-broadcast.png'), | ||
'camera': require('./icon-camera.png'), | ||
'channels': require('./icon-channels.png'), | ||
'chat-filled': require('./icon-chat-filled.png'), | ||
'chat': require('./icon-chat.png'), | ||
'checkbox-off': require('./icon-checkbox-off.png'), | ||
'checkbox-on': require('./icon-checkbox-on.png'), | ||
'chevron-down': require('./icon-chevron-down.png'), | ||
'chevron-right': require('./icon-chevron-right.png'), | ||
'close': require('./icon-close.png'), | ||
'copy': require('./icon-copy.png'), | ||
'create': require('./icon-create.png'), | ||
'delete-copy': require('./icon-delete-copy.png'), | ||
'delete': require('./icon-delete.png'), | ||
'document': require('./icon-document.png'), | ||
'done-all': require('./icon-done-all.png'), | ||
'done': require('./icon-done.png'), | ||
'download': require('./icon-download.png'), | ||
'edit': require('./icon-edit.png'), | ||
'emoji-more': require('./icon-emoji-more.png'), | ||
'error': require('./icon-error.png'), | ||
'file-audio': require('./icon-file-audio.png'), | ||
'file-document': require('./icon-file-document.png'), | ||
'freeze': require('./icon-freeze.png'), | ||
'gif': require('./icon-gif.png'), | ||
'info': require('./icon-info.png'), | ||
'leave': require('./icon-leave.png'), | ||
'members': require('./icon-members.png'), | ||
'message': require('./icon-message.png'), | ||
'moderations': require('./icon-moderations.png'), | ||
'more': require('./icon-more.png'), | ||
'mute': require('./icon-mute.png'), | ||
'notifications-filled': require('./icon-notifications-filled.png'), | ||
'notifications-off-filled': require('./icon-notifications-off-filled.png'), | ||
'notifications': require('./icon-notifications.png'), | ||
'operator': require('./icon-operator.png'), | ||
'photo': require('./icon-photo.png'), | ||
'play': require('./icon-play.png'), | ||
'plus': require('./icon-plus.png'), | ||
'question': require('./icon-question.png'), | ||
'refresh': require('./icon-refresh.png'), | ||
'remove': require('./icon-remove.png'), | ||
'reply-filled': require('./icon-reply-filled.png'), | ||
'reply': require('./icon-reply.png'), | ||
'search': require('./icon-search.png'), | ||
'send': require('./icon-send.png'), | ||
'settings-filled': require('./icon-settings-filled.png'), | ||
'spinner': require('./icon-spinner.png'), | ||
'streaming': require('./icon-streaming.png'), | ||
'supergroup': require('./icon-supergroup.png'), | ||
'theme': require('./icon-theme.png'), | ||
'thumbnail-none': require('./icon-thumbnail-none.png'), | ||
'unarchive': require('./icon-unarchive.png'), | ||
'user': require('./icon-user.png'), | ||
}; | ||
export default SBIconAssets; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
188 changes: 188 additions & 0 deletions
188
packages/uikit-react-native/src/ui/GroupChannelPreview/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
import React from 'react'; | ||
import { Image, Pressable, View } from 'react-native'; | ||
|
||
import { truncatedBadgeCount } from '@sendbird/uikit-utils'; | ||
|
||
import type SBIconAssets from '../../assets/icon'; | ||
import useUIKitTheme from '../../theme/useUIKitTheme'; | ||
import createStyleSheet from '../../utils/createStyleSheet'; | ||
import SBIcon from '../SBIcon'; | ||
import SBText from '../SBText'; | ||
|
||
type Props = { | ||
onPress?: () => void; | ||
|
||
coverUrl: string; | ||
|
||
title: string; | ||
titleCaption: string; | ||
bodyIcon?: keyof typeof SBIconAssets; | ||
body: string; | ||
|
||
memberCount?: number; | ||
badgeCount: number; | ||
|
||
frozen?: boolean; | ||
muted?: boolean; | ||
}; | ||
const GroupChannelPreview: React.FC<Props> = ({ | ||
onPress, | ||
coverUrl, | ||
memberCount, | ||
badgeCount, | ||
body, | ||
bodyIcon, | ||
title, | ||
titleCaption, | ||
frozen, | ||
muted, | ||
}) => { | ||
const { colors, select, palette } = useUIKitTheme(); | ||
|
||
return ( | ||
<Pressable onPress={() => onPress?.()} style={[styles.container, { backgroundColor: colors.background }]}> | ||
<Image | ||
resizeMode={'cover'} | ||
style={[styles.channelCover, { backgroundColor: colors.onBackground04 }]} | ||
source={{ uri: coverUrl }} | ||
/> | ||
<View style={styles.rightSection}> | ||
<View style={styles.rightTopSection}> | ||
<View style={styles.channelInfo}> | ||
<SBText subtitle1 style={styles.title}> | ||
{title} | ||
</SBText> | ||
{Boolean(memberCount) && ( | ||
<SBText caption1 style={styles.memberCount} color={colors.onBackground02}> | ||
{memberCount} | ||
</SBText> | ||
)} | ||
{frozen && <SBIcon size={16} icon={'freeze'} color={colors.primary} containerStyle={styles.frozen} />} | ||
{muted && <SBIcon size={16} icon={'notifications-off-filled'} color={colors.onBackground03} />} | ||
</View> | ||
<View style={styles.titleCaption}> | ||
<SBText caption2 color={colors.onBackground03}> | ||
{titleCaption} | ||
</SBText> | ||
</View> | ||
</View> | ||
|
||
<View style={styles.rightBottomSection}> | ||
<View style={styles.body}> | ||
{bodyIcon && ( | ||
<SBIcon | ||
size={18} | ||
icon={bodyIcon} | ||
color={colors.onBackground02} | ||
containerStyle={[ | ||
styles.bodyIcon, | ||
{ backgroundColor: select({ light: palette.background100, dark: palette.background500 }) }, | ||
]} | ||
/> | ||
)} | ||
<SBText body3 numberOfLines={1} style={styles.bodyText} color={colors.onBackground03}> | ||
{body} | ||
</SBText> | ||
</View> | ||
{badgeCount > 0 && ( | ||
<View | ||
style={[ | ||
styles.unreadBadge, | ||
{ backgroundColor: colors.primary, paddingTop: 2, paddingHorizontal: badgeCount >= 10 ? 8 : 0 }, | ||
]} | ||
> | ||
<SBText caption1 color={colors.background}> | ||
{truncatedBadgeCount(badgeCount)} | ||
</SBText> | ||
</View> | ||
)} | ||
</View> | ||
</View> | ||
<Separator /> | ||
</Pressable> | ||
); | ||
}; | ||
|
||
const Separator = () => { | ||
const { colors } = useUIKitTheme(); | ||
return <View style={[styles.separator, { backgroundColor: colors.onBackground04 }]} />; | ||
}; | ||
|
||
const styles = createStyleSheet({ | ||
container: { | ||
width: '100%', | ||
flexDirection: 'row', | ||
paddingHorizontal: 16, | ||
paddingVertical: 10, | ||
alignItems: 'center', | ||
}, | ||
channelCover: { | ||
width: 56, | ||
height: 56, | ||
borderRadius: 28, | ||
marginRight: 16, | ||
}, | ||
rightSection: { | ||
flex: 1, | ||
}, | ||
rightTopSection: { | ||
flexDirection: 'row', | ||
marginBottom: 4, | ||
}, | ||
channelInfo: { | ||
flex: 1, | ||
marginRight: 4, | ||
alignItems: 'center', | ||
flexDirection: 'row', | ||
}, | ||
title: { | ||
marginRight: 4, | ||
}, | ||
memberCount: { | ||
paddingTop: 2, | ||
marginRight: 4, | ||
}, | ||
titleCaption: { | ||
paddingTop: 2, | ||
}, | ||
rightBottomSection: { | ||
alignItems: 'center', | ||
flexDirection: 'row', | ||
height: 32, | ||
}, | ||
body: { | ||
marginRight: 4, | ||
flex: 1, | ||
alignItems: 'center', | ||
flexDirection: 'row', | ||
}, | ||
bodyText: { | ||
flex: 1, | ||
}, | ||
bodyIcon: { | ||
borderRadius: 8, | ||
width: 26, | ||
height: 26, | ||
marginRight: 4, | ||
}, | ||
unreadBadge: { | ||
minWidth: 20, | ||
minHeight: 20, | ||
borderRadius: 99, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
frozen: { | ||
marginRight: 4, | ||
}, | ||
separator: { | ||
position: 'absolute', | ||
right: 0, | ||
bottom: 0, | ||
backgroundColor: 'red', | ||
height: 1, | ||
width: '84.5%', | ||
}, | ||
}); | ||
|
||
export default GroupChannelPreview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import React from 'react'; | ||
import { Image, ImageStyle, StyleProp, StyleSheet, View, ViewStyle } from 'react-native'; | ||
|
||
import SBIconAssets from '../../assets/icon'; | ||
import useUIKitTheme from '../../theme/useUIKitTheme'; | ||
import createStyleSheet from '../../utils/createStyleSheet'; | ||
|
||
type IconNames = keyof typeof SBIconAssets; | ||
type SizeFactor = keyof typeof sizeStyles; | ||
|
||
type Props = { | ||
icon: IconNames; | ||
color?: string; | ||
size?: number; | ||
style?: StyleProp<ImageStyle>; | ||
containerStyle?: StyleProp<ViewStyle>; | ||
}; | ||
|
||
const SBIcon: React.FC<Props> = ({ icon, color, size = 24, containerStyle, style }) => { | ||
const sizeStyle = sizeStyles[size as SizeFactor] ?? { width: size, height: size }; | ||
const { colors } = useUIKitTheme(); | ||
return ( | ||
<View style={[containerStyle, containerStyles.container]}> | ||
<Image | ||
resizeMode={'contain'} | ||
source={SBIconAssets[icon]} | ||
style={[{ tintColor: color ?? colors.primary }, sizeStyle, style]} | ||
/> | ||
</View> | ||
); | ||
}; | ||
|
||
const containerStyles = StyleSheet.create({ | ||
container: { | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}, | ||
}); | ||
|
||
const sizeStyles = createStyleSheet({ | ||
16: { | ||
width: 16, | ||
height: 16, | ||
}, | ||
20: { | ||
width: 20, | ||
height: 20, | ||
}, | ||
24: { | ||
width: 24, | ||
height: 24, | ||
}, | ||
28: { | ||
width: 28, | ||
height: 28, | ||
}, | ||
32: { | ||
width: 32, | ||
height: 32, | ||
}, | ||
}); | ||
export default SBIcon; |
Oops, something went wrong.