Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mb/theme container #2715

Merged
merged 8 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint-disable radix */
import React from 'react';
import { View } from 'react-native';
import { useSelector } from 'react-redux';
import times from 'lodash/times';
import Placeholder from 'rn-placeholder';

import { ThemeContainer } from '../../../../containers';

// import { useSelector } from 'react-redux'; //NEW LINE ADDED
import styles from './boostPlaceHolderStyles';
import getWindowDimensions from '../../../../utils/getWindowDimensions';

Expand All @@ -14,37 +13,31 @@ const HEIGHT = getWindowDimensions().height;
const BoostPlaceHolder = () => {
const ratio = (HEIGHT - 300) / 50 / 1.3;
const listElements = [];

const isDarkTheme = useSelector((state) => state.application.isDarkTeme);
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
times(parseInt(ratio), (i) => {
listElements.push(
<ThemeContainer>
{({ isDarkTheme }) => {
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<View style={styles.container} key={`key-${i.toString()}`}>
<View style={styles.line}>
<Placeholder.Box color={color} width={90} height={40} animate="fade" />
<View style={styles.paragraphWrapper}>
<Placeholder.Box
color={color}
width={140}
radius={25}
height={50}
animate="fade"
/>
</View>
<Placeholder.Box
style={styles.rightBox}
color={color}
width={20}
height={10}
animate="fade"
/>
</View>
</View>
);
}}
</ThemeContainer>,
listElements.push(<View style={styles.container} key={`key-${i.toString()}`}>
<View style={styles.line}>
<Placeholder.Box color={color} width={90} height={40} animate="fade" />
<View style={styles.paragraphWrapper}>
<Placeholder.Box
color={color}
width={140}
radius={25}
height={50}
animate="fade"
/>
</View>
<Placeholder.Box
style={styles.rightBox}
color={color}
width={20}
height={10}
animate="fade"
/>
</View>
</View>

);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import React from 'react';
import { View } from 'react-native';

import LottieView from 'lottie-react-native';
import { ThemeContainer } from '../../../../containers';

import { useSelector } from 'react-redux';
import styles from './listItemPlaceHolderStyles';

const CommentPlaceHolderView = () => {
Expand All @@ -12,31 +11,31 @@ const CommentPlaceHolderView = () => {
height: 72,
};


const isDarkTheme = useSelector((state) => state.application.isDarkTheme);
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';

return (
<ThemeContainer>
{({ isDarkTheme }) => {
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<View style={styles.container}>
<LottieView
style={animationStyle}
source={require('../../../../assets/animations/commentBody.json')}
autoPlay
loop={true}
autoSize={true}
resizeMode="cover"
colorFilters={[
{
keypath: 'comments',
color,
},
]}
/>
</View>
);
}}
</ThemeContainer>
<View style={styles.container}>
<LottieView
style={animationStyle}
source={require('../../../../assets/animations/commentBody.json')}
autoPlay
loop={true}
autoSize={true}
resizeMode="cover"
colorFilters={[
{
keypath: 'comments',
color,
},
]}
/>
</View>
);



};

export default CommentPlaceHolderView;
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,29 @@ import React from 'react';
import { View } from 'react-native';
import Placeholder from 'rn-placeholder';

import { ThemeContainer } from '../../../../containers';
import { useSelector } from 'react-redux';

import styles from './postCardPlaceHolderStyles';
// TODO: make container for place holder wrapper after alpha
const PostCardPlaceHolder = () => {
const isDarkTheme = useSelector((state) => state.application.isDarkTheme)
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<ThemeContainer>
{({ isDarkTheme }) => {
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<View style={styles.container}>
<View style={styles.paragraphWrapper}>
<Placeholder.Paragraph
lineNumber={4}
color={color}
textSize={16}
lineSpacing={5}
width="100%"
lastLineWidth="70%"
firstLineWidth="20%"
animate="fade"
/>
</View>
</View>
);
}}
</ThemeContainer>
<View style={styles.container}>
<View style={styles.paragraphWrapper}>
<Placeholder.Paragraph
lineNumber={4}
color={color}
textSize={16}
lineSpacing={5}
width="100%"
lastLineWidth="70%"
firstLineWidth="20%"
animate="fade"
/>
</View>
</View>
);

};
export default PostCardPlaceHolder;
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,32 @@ import React from 'react';
import { View } from 'react-native';
import Placeholder from 'rn-placeholder';

import { ThemeContainer } from '../../../../containers';
import { useSelector } from 'react-redux';

import styles from './listItemPlaceHolderStyles';

const ListItemPlaceHolderView = () => {

const isDarkTheme = useSelector((state) => state.application.isDarkTheme);
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<ThemeContainer>
{({ isDarkTheme }) => {
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<View style={styles.container}>
<Placeholder.Media size={30} hasRadius animate="fade" color={color} />
<View style={styles.paragraphWrapper}>
<Placeholder.Paragraph
color={color}
lineNumber={2}
textSize={12}
lineSpacing={8}
width="100%"
lastLineWidth="70%"
firstLineWidth="50%"
animate="fade"
/>
</View>
</View>
);
}}
</ThemeContainer>
<View style={styles.container}>
<Placeholder.Media size={30} hasRadius animate="fade" color={color} />
<View style={styles.paragraphWrapper}>
<Placeholder.Paragraph
color={color}
lineNumber={2}
textSize={12}
lineSpacing={8}
width="100%"
lastLineWidth="70%"
firstLineWidth="50%"
animate="fade"
/>
</View>
</View>
);

};

export default ListItemPlaceHolderView;
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
import React from 'react';
import { View } from 'react-native';
import LottieView from 'lottie-react-native';
import { ThemeContainer } from '../../../../containers';
import { useSelector } from 'react-redux';
import styles from './postCardPlaceHolderStyles';
import getWindowDimensions from '../../../../utils/getWindowDimensions';

const PostCardPlaceHolder = () => {
const animationStyle = {
width: getWindowDimensions().nativeWidth - 32,
};

const isDarkTheme = useSelector((state) => state.application.isDarkTheme);
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<ThemeContainer>
{({ isDarkTheme }) => {
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';
return (
<View style={styles.container}>
<LottieView
style={animationStyle}
source={require('../../../../assets/animations/postList.json')}
autoPlay
loop={true}
autoSize={true}
resizeMode="cover"
colorFilters={[
{
keypath: 'postList',
color,
},
]}
/>
</View>
);
}}
</ThemeContainer>
<View style={styles.container}>
<LottieView
style={animationStyle}
source={require('../../../../assets/animations/postList.json')}
autoPlay
loop={true}
autoSize={true}
resizeMode="cover"
colorFilters={[
{
keypath: 'postList',
color,
},
]}
/>
</View>
);

};
export default PostCardPlaceHolder;
Original file line number Diff line number Diff line change
@@ -1,36 +1,33 @@
import React from 'react';
import { View } from 'react-native';
import LottieView from 'lottie-react-native';
import { ThemeContainer } from '../../../../containers';
import getWindowDimensions from '../../../../utils/getWindowDimensions';
import { useSelector } from 'react-redux';

import getWindowDimensions from '../../../../utils/getWindowDimensions';
const PostPlaceHolder = () => {
return (
<ThemeContainer>
{({ isDarkTheme }) => {
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';

return (
<View>
<LottieView
style={{ width: getWindowDimensions().nativeWidth - 24 }}
source={require('../../../../assets/animations/postBody.json')}
autoPlay
loop={true}
autoSize={true}
resizeMode="cover"
colorFilters={[
{
keypath: 'layer1',
color,
},
]}
/>
</View>
);
}}
</ThemeContainer>
const isDarkTheme = useSelector((state) => state.application.isDarkTheme);
const color = isDarkTheme ? '#2e3d51' : '#f5f5f5';

return (
<View>
<LottieView
style={{ width: getWindowDimensions().nativeWidth - 24 }}
source={require('../../../../assets/animations/postBody.json')}
autoPlay
loop={true}
autoSize={true}
resizeMode="cover"
colorFilters={[
{
keypath: 'layer1',
color,
},
]}
/>
</View>
);

};

export default PostPlaceHolder;
Loading