diff --git a/app/views/WorkspaceView/ServerAvatar.stories.tsx b/app/views/WorkspaceView/ServerAvatar.stories.tsx new file mode 100644 index 00000000000..c35e0690633 --- /dev/null +++ b/app/views/WorkspaceView/ServerAvatar.stories.tsx @@ -0,0 +1,51 @@ +import React from 'react'; + +import { themes } from '../../lib/constants/colors'; +import ServerAvatar from './ServerAvatar'; +import { ThemeContext, type TSupportedThemes } from '../../theme'; + +export default { + title: 'WorkspaceView/ServerAvatar' +}; + +const BASE_URL = 'https://open.rocket.chat'; + +const ThemedServerAvatar = ({ + url = BASE_URL, + image, + theme = 'light' +}: { + url?: string; + image?: string; + theme?: TSupportedThemes; +}) => ( + + + +); + +export const WithImage = () => ; + +export const WithoutImage = () => ; + +export const WithEmptyImage = () => ; + +export const Themes = () => ( + <> + + + + +); + +export const SkeletonThemes = () => ( + <> + + + + +); diff --git a/app/views/WorkspaceView/ServerAvatar.test.tsx b/app/views/WorkspaceView/ServerAvatar.test.tsx new file mode 100644 index 00000000000..dd8beff666e --- /dev/null +++ b/app/views/WorkspaceView/ServerAvatar.test.tsx @@ -0,0 +1,4 @@ +import { generateSnapshots } from '../../../.rnstorybook/generateSnapshots'; +import * as stories from './ServerAvatar.stories'; + +generateSnapshots(stories); diff --git a/app/views/WorkspaceView/ServerAvatar.tsx b/app/views/WorkspaceView/ServerAvatar.tsx index 99a6e47f88d..5d14649428a 100644 --- a/app/views/WorkspaceView/ServerAvatar.tsx +++ b/app/views/WorkspaceView/ServerAvatar.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { StyleSheet, View } from 'react-native'; import { Image } from 'expo-image'; +import SkeletonPlaceholder from 'react-native-skeleton-placeholder'; import { isTablet } from '../../lib/methods/helpers'; import { useTheme } from '../../theme'; @@ -26,16 +27,21 @@ const styles = StyleSheet.create({ interface IServerAvatar { url: string; - image: string; + image?: string; } -// TODO: missing skeleton const ServerAvatar = React.memo(({ url, image }: IServerAvatar) => { const { colors } = useTheme(); return ( - {image && } + {image ? ( + + ) : ( + + + + )} ); });