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

Added a section of home page #134

Closed
wants to merge 19 commits into from
Closed
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
49 changes: 49 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"@types/styled-components": "^5.1.2",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-native-animated-number": "^1.1.1",
Expand Down
3 changes: 2 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { View } from 'react-native';
import Header from './Components/Header';
import Content from './Components/Content';
import Footer from './Components/Footer';
import Home from './Components/Home';

function App() {
const [selected, setSelected] = useState(0);
Expand All @@ -23,4 +24,4 @@ function App() {
);
}

export default App;
export default App;
4 changes: 4 additions & 0 deletions src/Components/Content/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import React from 'react';
import { View, Text, Image } from 'react-native';
import Projects from './../Projects';
import Home from './../Home';

function Content({ selected, titles }) {
if(selected === 0){
return <Home />
}
if (selected === 3) {
return <Projects />;
} else {
Expand Down
18 changes: 18 additions & 0 deletions src/Components/Home/GettingStarted.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { MainContainer } from './styles';
import ImageTextSection from '../ImageTextSection';

function GettingStarted({content}){
return(
<MainContainer>
<ImageTextSection
title = {content.title}
image = {content.image.source}
content = {content.content}
imageHeight = {273}
/>
</MainContainer>
);
}

export default GettingStarted;
19 changes: 19 additions & 0 deletions src/Components/Home/OpenSourcePrograms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { MainContainer } from './styles';
import ImageTextSection from '../ImageTextSection';

function GettingStarted({content}){
return(
<MainContainer>
<ImageTextSection
title = {content.title}
imageSide = {'right'}
image = {content.image.source}
content = {content.content}
imageHeight = {208}
/>
</MainContainer>
);
}

export default GettingStarted;
18 changes: 18 additions & 0 deletions src/Components/Home/OurProjects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { MainContainer } from './styles';
import ImageTextSection from '../ImageTextSection';

function GettingStarted({content}){
return(
<MainContainer>
<ImageTextSection
title = {content.title}
image = {content.image.source}
content = {content.content}
imageHeight = {261}
/>
</MainContainer>
);
}

export default GettingStarted;
19 changes: 19 additions & 0 deletions src/Components/Home/WaysToContribute.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { MainContainer } from './styles';
import ImageTextSection from '../ImageTextSection';

function GettingStarted({content}){
return(
<MainContainer>
<ImageTextSection
title = {content.title}
image = {content.image.source}
content = {content.content}
imageSide = {'right'}
imageHeight = {220}
/>
</MainContainer>
);
}

export default GettingStarted;
23 changes: 23 additions & 0 deletions src/Components/Home/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import React from 'react';
import GettingStarted from './GettingStarted';
import OurProjects from './OurProjects';
import OpenSourcePrograms from './OpenSourcePrograms';
import WaysToContribute from './WaysToContribute';
import { ParentContainer} from './styles';
import { getHome } from './../../content/home';

const home = getHome();
const {sections} = home;
function Home(){

return(
<ParentContainer>
<GettingStarted content={sections[0]}/>
<WaysToContribute content={sections[1]}/>
<OurProjects content={sections[2]}/>
<OpenSourcePrograms content={sections[3]}/>
</ParentContainer>
);
}

export default Home;
16 changes: 16 additions & 0 deletions src/Components/Home/styles.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { View } from 'react-native';
import { styled } from "react-native-reflect";

export const MainContainer = styled(View,{
flex: 1,
flexWrap: 'wrap',
justifyContent: 'space-around',
flexDirection: 'row',
})

export const ParentContainer = styled(View,{
flexDirection: 'column',
flexWrap: 'wrap',
marginTop: 32,
marginBottom: 32
})
6 changes: 3 additions & 3 deletions src/Components/ImageTextSection/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import ScaledImage from './../ScaledImage';

const ImageTextSection = ({
title,
image,
Expand All @@ -19,8 +18,8 @@ const ImageTextSection = ({
/>
<View style={styles.subContainer}>
<Text style={styles.header}>{title}</Text>
{content.map((text) => (
<Text style={styles.text}>{text.par}</Text>
{content.map((text, i) => (
<Text key={i} style={styles.text}>{text.par}</Text>
))}
</View>
</View>
Expand All @@ -46,6 +45,7 @@ const createStyles = (imageSide) =>
sectionImage: {
paddingLeft: 16,
paddingRight: 16,
alignSelf: 'center'
},
header: {
flex: 0,
Expand Down
32 changes: 32 additions & 0 deletions src/Components/SectionBody/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import { View, Text, StyleSheet, Dimensions } from 'react-native';

const {width} = Dimensions.get('window');
function SectionBody({content, width}){
return (
<View style={styles.container} >
<Text style={styles.body}>{content}</Text>
</View>
);
}

const styles = StyleSheet.create({
body: {
fontSize: 18,
color: '#103BB1',
fontFamily:'./../../Avenir-Light',
textAlign:"left",
flexWrap:"wrap",
fontWeight: 200,
},
container: {
flex: 1,
width: (width - 0.7*width>=400) ? width*0.7 : width*0.9,
marginTop: 8,
paddingLeft: 16,
paddingRight: 16,
},
});

export default SectionBody;

4 changes: 2 additions & 2 deletions src/Components/SectionHeader/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';

function SectionHeader({ title, index }) {
function SectionHeader({ title, index}) {
return (
<View style={styles.container} key={title + index}>
<Text style={styles.header}>{title}</Text>
Expand All @@ -20,7 +20,7 @@ const styles = StyleSheet.create({
container: {
flex: 1,
width: '100%',
paddingTop: 64,
paddingTop: 32,
paddingLeft: 16,
paddingRight: 16,
},
Expand Down
27 changes: 27 additions & 0 deletions src/Components/SectionImage/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import {View, Image } from 'react-native';


function SectionImage({source, width, height}){
const viewStyle = {
alignSelf: 'center',
width: 350,
marginTop: 32+8,
}
const imageStyle = {
width: width,
height: height,
alignSelf: 'center',
}
return(
<View style={viewStyle}>
<Image
source={source}
style = {imageStyle}
/>
</View>
)
}


export default SectionImage;
Binary file added src/assets/home/contribute.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/home/our-projects.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/home/space1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/home/started.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading