Skip to content

Instantly share code, notes, and snippets.

View Nedson202's full-sized avatar

Samson Negedu Nedson202

  • @cosi_group
  • Berlin, Germany
View GitHub Profile
@Nedson202
Nedson202 / App.js
Last active February 25, 2019 15:11
Root
import React, { Component } from "react";
import "../App.css";
import images from "../helper/images";
import ImageCard from "./ImageCard";
class App extends Component {
renderImages() {
return (
<div className="image-list">
{images.map(data => (
@Nedson202
Nedson202 / ImageLoader.jsx
Created February 25, 2019 15:00
Content loader for images
import React, { Component, Fragment } from 'react';
import ContentLoader from 'react-content-loader';
class ImageLoader extends Component {
render() {
const { size: { height, width } } = this.props;
return (
<Fragment>
<ContentLoader
@Nedson202
Nedson202 / ImageCard.jsx
Last active April 6, 2019 13:24
Image loader component
import React, { Component, Fragment } from "react";
import ImageLoader from "../ContentLoaders/ImageLoader";
class ImageCard extends Component {
state = {
loadedErrorMessage: '',
imageUrl: '',
imageLoaded: false,
imageLoadError: false,
};
@Nedson202
Nedson202 / NetworkDetector.jsx
Last active February 23, 2022 00:11
Higher order component that watches for changes in network connection
import React, { Component } from 'react';
export default function (ComposedComponent) {
class NetworkDetector extends Component {
state = {
isDisconnected: false
}
componentDidMount() {
this.handleConnectionChange();
body {
margin: 0;
padding: 0;
font-family: Georgia, 'Times New Roman', Times, serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
}
code {
@Nedson202
Nedson202 / App.css
Last active February 25, 2019 14:40
.app {
text-align: center;
}
.app p {
font-size: 30px;
font-family: Georgia, 'Times New Roman', Times, serif;
}
.app .page-title {
@Nedson202
Nedson202 / App.js
Last active January 6, 2019 09:16
This is the entry point in the bootstrapped app using create-react-app
import React, { Component } from 'react';
import './App.css';
import images from './helper/images'
import NetworkDetector from './Hoc/NetworkDetector';
class App extends Component {
renderImage() {
return (
<div className='image-list'>
{images.map(data => <img src={data.image} alt='random' key={data.id} className="image" />)}
@Nedson202
Nedson202 / images.js
Last active February 25, 2019 14:37
An array of images to be rendered
const images = [
{
id: 1,
image: 'https://lorempixel.com/200/300/abstract/3',
size: {
width: 200,
height: 300,
}
},
{

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a