Git Product home page Git Product logo

social-widget's Introduction

Social Widget

Installation

  1. Download latest JS file from releases or directly social-widget.min.js
  2. Place it in your website root directory and link with <script...></script> tags

OR

  1. Link it directly from Github (not recommended) with: <script src="https://github.com/jmarceli/social-widget/releases/download/v0.1.1/social-widget.min.js"></script>

Example

Check project Github Pages for usage example:

https://jmarceli.github.io/social-widget/

Documentation

There is only a single HTML tag required to display this social widget.

<div data-root data-url="./harvey.json"></div>

Where:

  • data-root - indicates element which will be used to mount component
  • data-url - JSON data source URL

JSON data source example:

{
  "profile": {
    "imgSrc": "./harvey-specter.jpg",
    "name": "Harvey Specter",
    "city": "New York",
    "country": "USA",
    "likes": 121,
    "following": 723,
    "followers": 4433
  },
  "commentList": [
    {
      "author": "Mike Ross",
      "content": "New. Lorem ipsum dolor it amet enim. Etiam...",
      "pubTimestamp": 1542942781731,
      "imgSrc": "./harvey-specter.jpg"
    },
    {
      "author": "Mike Ross",
      "content": "Lorem ipsum dolor it amet enim. Etiam...",
      "pubTimestamp": 1542542781731,
      "imgSrc": "./harvey-specter.jpg"
    },
    {
      "author": "Mike Ross",
      "content": "OLD. Lorem ipsum dolor it amet enim. Etiam...",
      "pubTimestamp": 1542411681731,
      "imgSrc": "./harvey-specter.jpg"
    },
    {
      "author": "Mike Ross",
      "content": "Lorem ipsum dolor it amet enim. Etiam...",
      "pubTimestamp": 1542542781731,
      "imgSrc": "./harvey-specter.jpg"
    },
    {
      "author": "Mike Ross",
      "content": "Lorem ipsum dolor it amet enim. Etiam...",
      "pubTimestamp": 1542542781731,
      "imgSrc": "./harvey-specter.jpg"
    },
    {
      "author": "Mike Ross",
      "content": "Lorem ipsum dolor it amet enim. Etiam...",
      "pubTimestamp": 1542542781731,
      "imgSrc": "./harvey-specter.jpg"
    },
    {
      "author": "Mike Ross",
      "content": "Lorem ipsum dolor it amet enim. Etiam...",
      "pubTimestamp": 1542542781731,
      "imgSrc": "./harvey-specter.jpg"
    }
  ]
}

Where:

  • profile - is a profile data section
  • profile.imgSrc - person image in profile section (absolute or relative URL to image)
  • profile.name - person name
  • profile.city - location info
  • profile.country - location info
  • profile.likes - number of likes
  • profile.following - number of followed people
  • profile.followers - number of followers (incremented with FOLLOW button)
  • commentList[] - array with comment objects
  • commentList[].author - comment author name and surname
  • commentList[].content - comment content
  • commentList[].pubTimestamp - comment publication timestamp
  • commentList[].imgSrc - comment author image

Known bugs

  • empty commentList info message doesn't have correct font-family
  • empty commentList[].imgSrc is not supported

TODO

  • persistance support (e.g. LocalStorage)
  • cross-browser compatibility test (e.g. with BrowserStack)
  • "load more" button for comments on comments list
  • JSON values validation
  • unwanted padding after closing comments list
  • use Pure.Components to optimize comments performance
  • compare "traditional" state with Redux and ApolloGraphQL managers

Jan Grzegorowski

social-widget's People

Contributors

jmarceli avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.