Categoris (wip)

This commit is contained in:
MedihaZukic
2017-09-23 11:31:22 +02:00
parent 1a3b16c426
commit 2c6ca79505
14 changed files with 1039 additions and 39 deletions

3
.eslintrc Normal file
View File

@@ -0,0 +1,3 @@
{
"extends": "rallycoding"
}

View File

@@ -1,53 +1,19 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react'; import React, { Component } from 'react';
import { import {
AppRegistry, AppRegistry,
StyleSheet,
Text,
View View
} from 'react-native'; } from 'react-native';
import Categories from './src/components/Categories';
export default class meme extends Component { export default class meme extends Component {
render() { render() {
return ( return (
<View style={styles.container}> <View>
<Text style={styles.welcome}> <Categories />
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
</View> </View>
); );
} }
} }
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});
AppRegistry.registerComponent('meme', () => meme); AppRegistry.registerComponent('meme', () => meme);

942
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,10 +13,11 @@
"devDependencies": { "devDependencies": {
"babel-jest": "21.0.2", "babel-jest": "21.0.2",
"babel-preset-react-native": "4.0.0", "babel-preset-react-native": "4.0.0",
"eslint-config-rallycoding": "^3.2.0",
"jest": "21.1.0", "jest": "21.1.0",
"react-test-renderer": "16.0.0-alpha.12" "react-test-renderer": "16.0.0-alpha.12"
}, },
"jest": { "jest": {
"preset": "react-native" "preset": "react-native"
} }
} }

View File

View File

@@ -0,0 +1,29 @@
import React from 'react';
import { View, Text } from 'react-native';
const ApplicationHeader = (props) => {
const { headerTextStyle } = styles;
return (
<View style={headerStyle(props.headerBackgroudColor)}>
<Text style={headerTextStyle}>{props.headerText}</Text>
</View>
);
};
const headerStyle = function (headerBackgroudColor) {
return {
backgroundColor: headerBackgroudColor,
height: 50,
justifyContent: 'center',
alignItems: 'center'
};
};
const styles = {
headerTextStyle: {
fontSize: 20,
color: '#fff'
}
};
export default ApplicationHeader;

View File

@@ -0,0 +1,29 @@
import React from 'react';
import { View } from 'react-native';
import ApplicationHeader from './ApplicationHeader';
import CategoryItem from './CategoryItem';
const Categories = () => {
const { categoriesListStyle } = styles;
return (
<View>
<ApplicationHeader headerText='MeMe' headerBackgroudColor='#6d6e71' />
<View style={categoriesListStyle}>
<CategoryItem categoryName='ANATOMIJA' categoryBackgroudColor='#f7bcbc' />
<CategoryItem categoryName='LEKCIJE' categoryBackgroudColor='#f4d4d4' />
<CategoryItem categoryName='UPITNIK' categoryBackgroudColor='#bcbec0' />
<CategoryItem categoryName='REKLA KAZALA' categoryBackgroudColor='#e6e51a' />
</View>
</View>
);
};
const styles = {
categoriesListStyle: {
flexDirection: 'column',
justifyContent: 'center'
}
};
export default Categories;

View File

@@ -0,0 +1,30 @@
import React from 'react';
import { Text, View } from 'react-native';
const CategoryItem = (props) => {
const { categoryTextStyle } = styles;
return (
<View style={containerStyle(props.categoryBackgroudColor)}>
<Text style={categoryTextStyle}>
{props.categoryName}
</Text>
</View>
);
};
const containerStyle = function (containerBackgroudColor) {
return {
backgroundColor: containerBackgroudColor,
justifyContent: 'center',
alignItems: 'center'
};
};
const styles = {
categoryTextStyle: {
fontSize: 20,
color: '#fff'
}
};
export default CategoryItem;