Code Monkey home page Code Monkey logo

dev-widget's Introduction

DEV widget

GitHub package.json version Contributions to DEV Widget are welcomed

GUI to Generate Card: https://dev-widget.netlify.app/create

Codepen: https://codepen.io/saurabhdaware/pen/NWWbOvv

Unofficial Widget / profile card for dev.to.

You can use it in your website/blog and show off your DEV.to articles ๐ŸŒป

Screenshot of the DEV.to Widget


Installation and Usage

- Through script tag

    <dev-widget data-username="saurabhdaware"></dev-widget>

    <!-- Place script tag before the end of the body tag -->
    <script src="https://unpkg.com/dev-widget@^1/dist/card.component.min.mjs" type="module"></script>

- As NPM module

This can be used in React, Vue and almost any other frontend framework

npm install --save dev-widget

Inside your framework component

import 'dev-widget'

Attributes Guide

attributes description default
data-username Your DEV.to Username
data-width Width of the card 300px
data-contentheight Height of the Aricles Container 300px
data-theme Theme of the card (dark, ocean, pink, cobalt2, default) default
data-name (optional) Name to display on card Will be fetched from API
data-limit Number of articles to display 30
data-sortby Sort articles (date, reactions) date

Note: Value of data-limit should not be too high. An API request has to be made for every 30 articles so for data-limit=200 7 API requests will be made synchronously.

So a full example with every attribute would look something like

<dev-widget 
    data-username="saurabhdaware" 
    data-theme="ocean" 
    data-sortby="reactions" 
    data-width="320px" 
    data-contentheight="200px" 
    data-limit="3" 
    data-name="Saurabh ๐Ÿ˜Ž" 
></dev-widget>

<!-- Place script tag before the end of the body tag -->
<script src="https://unpkg.com/dev-widget@^1/dist/card.component.min.mjs" type="module"></script>

Note: Only data-username is neccessary and every other attribute is optional


Themes

default ocean pink dark cobalt2 DEV Widget themes


Changelog

RELEASES


Contributing

I would love to have some of your contributions to this project. You can checkout CONTRIBUTING.md for Contribution guidelines.

dev-widget's People

Contributors

binyamin avatar prafulla-codes avatar saurabhdaware avatar sushantrahate avatar swap9820 avatar thewasif avatar ynfle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dev-widget's Issues

Setup a minifier in build

Currently, build/build.main.js only copy pastes content from src to dist and creates index.js for the entry point in ES6 imports. It would be better if we could minify card.component.mjs and card.style.mjs during the build.

card padding or border

Currently, it's difficult to distinguish the edges of the default or pink themes on a white background. Adding a padding would help. Alternatively, add a border using the --header-bg variable. If you're using a border, I would do away with the box shadow (from what I understand, according to material design it's an either-or)

[Request] Self-closing tag

I'm not familiar with mjs, so I don't even know if it's possible. But, since the card requires no children when it initializes itself, can you make the tag self closing (<dev-widget data-username="foo" />)? Currently, the browser will automatically close the tag after whatever content comes next. See example on Codepen. (Example gone)

New attribute to set card theme

It would look something like

<dev-widget data-username="saurabhdaware" data-theme="pink"></dev-widget>

This will set appropriate header and content colors. We can have themes like dark, pink, blue

Refactor the themes part

So currently if someone wants to create a theme they have to go to the card.style.mjs and add a class with name of the theme and set the css variables.

This is super useful and makes things extremely easy to create themes but as we go adding themes we go on increasing the numbers of lines in the JavaScript string (the css is just javascript string). It would be helpful if there is any other way to handle this since I don't want to go on making the response size larger and larger.

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.