diff --git a/src/App.js b/src/App.js index c8aa27e..6335570 100644 --- a/src/App.js +++ b/src/App.js @@ -1,21 +1,27 @@ -import React, { Component } from 'react'; -import logo from './logo.svg'; +import React, {Component} from 'react'; import './App.css'; +import Me from "./Me"; class App extends Component { - render() { - return ( -
-
- logo -

Welcome to React

-
-

- Journey of React begins.... -

-
- ); - } + + toggle = false; + + constructor(props) { + super(props); + } + + render() { + return ( +
+
+ logo +

Welcome {this.props.data.firstName} + {this.props.data.lastName}

+
+ +
+ ); + } } -export default App; +export default App; \ No newline at end of file diff --git a/src/Me.js b/src/Me.js index 8509a3d..d5716a3 100644 --- a/src/Me.js +++ b/src/Me.js @@ -1,10 +1,13 @@ import React from 'react'; +import SocialDetails from "./SocialDetails"; -function Me({ data, toggle }) { +function Me({userDetails}) { return (
-

{data.firstName}

- { toggle && {data.lastName}} +

Social Presence

+
) } diff --git a/src/SocialDetails.js b/src/SocialDetails.js new file mode 100644 index 0000000..70a9928 --- /dev/null +++ b/src/SocialDetails.js @@ -0,0 +1,18 @@ +import React from 'react'; + +function SocialDetails({socialDetails}) { + return ( +
+

{socialDetails.provider} + {socialDetails.username !== undefined && " - " + socialDetails.username} + {socialDetails.channel !== undefined && " - " + socialDetails.channel} + {socialDetails.link !== undefined && " - " + socialDetails.link} + {socialDetails.url !== undefined && " - " + socialDetails.url} + {socialDetails.type !== undefined && " - " + socialDetails.type} + {" - " + socialDetails.engagement.join(", ")} +

+
+ ) +} + +export default SocialDetails \ No newline at end of file diff --git a/src/index.js b/src/index.js index 395b749..ab02bc8 100644 --- a/src/index.js +++ b/src/index.js @@ -3,4 +3,45 @@ import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; -ReactDOM.render(, document.getElementById('root')); +window.data = { + firstName: 'Aravind', + lastName: 'M', + image: '', + details: [ + { + id:1, + provider: 'facebook', + username: 'mak11195', + engagement: ['personal'], + link: '' + }, + { + id:2, + provider: 'github', + username: 'makaravind', + engagement: ['professional'], + link: 'https://github.com/makaravind' + }, + { + id:3, + provider: 'gmail', + username: 'aravindmetku@gmail.com', + engagement: ['professional', 'personal'], + }, + { + id:4, + provider: 'youtube', + channel: 'amyourmove', + url: 'youtube.com/c/amyourmove', + engagement: ['professional'], + }, + { + id:5, + provider: 'wordpress', + type: 'blog', + url: 'https://maravindblog.wordpress.com', + engagement: ['professional'], + } + ] +}; +ReactDOM.render(, document.getElementById('root'));