Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- GitHub Card With ReactJs - Created By Hamed Esmaili -->
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Titillium+Web:400,700,600);

$titillium :'Titillium Web', sans-serif;
$primary-color:#1a4e8e;
$gray:#ecf0f1;

body{background:$gray; font-family:$titillium;font-weight:400;}
*{
	margin:0;
	padding:0;
    box-sizing: border-box;
    &:active, &:focus{
    	border: 0;
    	outline: 0;
    }
}
a{text-decoration: none;display: inline-block;}

#card{width:25rem;margin:auto;overflow:hidden;
	position: absolute;top: 50%;left: 50%;
	transform: translateX(-50%) translateY(-50%);
}
.search--box{
	label{position: relative;
		&:after{position: absolute;content:"";
		border-right:.625rem solid transparent;border-left:.625rem solid transparent;border-bottom:.625rem solid #fff;
		bottom:-1.0625rem;right:50%;margin-right:-0.3125rem;
		}
	}
	input[type='search']{width:100%; font:1rem $titillium;color:$primary-color; border:0;padding:.75rem .9375rem .9375rem;
		background:darken($gray, 2%);border-radius:.3125rem .3125rem 0 0;text-align: center;box-sizing: border-box;
	}
}
.notfound{background: #fff;padding:1.875rem;text-align: center;
	h2{font-size:2rem;color:lighten($primary-color, 11%);margin-bottom:.625rem;}
	p{font-size:1rem;color:darken($gray, 25%);}
}
.github--profile{width:100%;
	&__info{background: #fff;text-align: center;padding:1.875rem .9375rem;
		img{width:6.25rem;height:6.25rem;border-radius:50%;display: block;box-shadow:0 0 .0625rem rgba(0,0,0,.5);}
		h2 a{font-size:1.65rem;color:lighten($primary-color, 11%);}
		h3{font-size:1.1885rem;color:darken($gray, 16%);}
	}
	&__state{background:$primary-color;text-align: center;padding:1.875rem .9375rem;border-radius:0 0 .3125rem .3125rem;
		ul{direction:ltr;}
		li{list-style: none;display: inline-block;margin-right:1rem; &:last-child{margin-right:0;}}
		a{color:#fff;}
		i{font-size:1.5rem;font-weight:700;font-style: normal;display: block;}
		span{font-size:.844rem;letter-spacing:.0625rem;color:lighten($primary-color, 17%);}
	}
}

.hesmaili{font-size:.9rem;font-weight:400;color:darken($gray, 19%); 
position: absolute;bottom:3%;left:50%;transform: translateX(-50%);
	a{color:lighten($primary-color, 11%);}
}
              
            
!

JS

              
                const API = 'https://api.github.com/users';
class App extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      username: 'theham3d',
      name:'',
      avatar:'',
      location:'',
      repos:'',
      followers: '',
      following:'',
      homeUrl:'',
      notFound:''
    }
  }
  fetchProfile(username) { 
    let url = `${API}/${username}`;
    fetch(url)
      .then((res) => res.json() )
      .then((data) => {
        this.setState({
          username: data.login,
          name: data.name,
          avatar: data.avatar_url,
          location: data.location,
          repos: data.public_repos,
          followers: data.followers,
          following: data.following,
          homeUrl: data.html_url,
          notFound: data.message
        })
      })
      .catch((error) => console.log('Oops! . There Is A Problem') )
  }
  componentDidMount() {
    this.fetchProfile(this.state.username);
  }
  render() {
    return (
      <div>
         <section id="card">
           <SearchProfile fetchProfile={this.fetchProfile.bind(this)}/>
           <Profile data={this.state} />
         </section>
          <span className="hesmaili">GitHub Card With ReactJs - Created By <a href="https://twitter.com/theham3d" target="_blank" title="Hamed Esmaili">Hamed Esmaili</a></span>
      </div>
    )
  }
}
class SearchProfile extends React.Component {
  render() {
    return (
      <div className="search--box">
         <form onSubmit={this.handleForm.bind(this)}>
           <label><input type="search" ref="username" placeholder="Type Username + Enter"/></label>
         </form>
      </div>
    )
  }
  
  handleForm(e) {
   e.preventDefault();
    let username = this.refs.username.getDOMNode().value
    this.props.fetchProfile(username);
    this.refs.username.getDOMNode().value = '';
  }
}

class Profile extends React.Component {
  render() {
    let data = this.props.data;
    let followers = `${data.homeUrl}/followers`;
    let repositories = `${data.homeUrl}?tab=repositories`;
    let following = `${data.homeUrl}/following`;
    if (data.notFound === 'Not Found')
      return (
         <div className="notfound">
            <h2>Oops !!!</h2>
            <p>The Component Couldn't Find The You Were Looking For . Try Again </p>
         </div>
      );
      else
      return (
        <section className="github--profile">
          <div className="github--profile__info">
            <a href={data.homeUrl} target="_blank" title={data.name || data.username}><img src={data.avatar} alt={data.username}/></a>
            <h2><a href={data.homeUrl} title={data.username} target="_blank">{data.name || data.username}</a></h2>
            <h3>{data.location || 'I Live In My Mind'}</h3>
          </div>
          <div className="github--profile__state">
            <ul>
               <li>
                  <a href={followers} target="_blank" title="Number Of Followers"><i>{data.followers}</i><span>Followers</span></a>
               </li>
               <li>
                  <a href={repositories} target="_blank" title="Number Of Repositoriy"><i>{data.repos}</i><span>Repositoriy</span></a>
               </li>
               <li>
                  <a href={following} target="_blank" title="Number Of Following"><i>{data.following}</i><span>Following</span></a>
               </li>
            </ul>
          </div>
        </section>
      );
  }
}

React.render(<App />, document.body);
              
            
!
999px

Console