Code Monkey home page Code Monkey logo

sd's Introduction

SmartDeFi Widget

Installation

Include the javascript and css files into your website

CSS

<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/sdwidget/sd/css/sdwidget.css" />

JS

<script src="https://cdn.jsdelivr.net/gh/sdwidget/sd/js/sdwidget.js" defer></script>

Best practice

Add the css to the <head> section and js at the end of your <body> element

Note - if the js script is not placed at end of <body>, make sure you include defer in <script> tag

Usage

Add a <div id="sd-widget"></div> element where you would like the widget to display and add the corresponding data properties.

Property Required Values Description
data-token required Token address
data-chain required 56 or 1 56 for BSC or 1 for ETH
data-infura optional infura API key Required for ETH chain
data-theme optional dark or light Default dark
data-elevation optional on or off Default off

Rendering element example

<div id="sd-widget" data-token="SD token address" data-chain="56" data-theme="dark" data-elevation="on"></div>

Full code example

<!doctype html>
<html lang="en">
  <head>

    <!-- SmartDeFi CSS file -->
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/sdwidget/sd/css/sdwidget.css" />
    
    <title>SmartDeFi Widget</title>
  </head>
  <body>

  <!-- SmartDeFi render element -->
  <div id="sd-widget" data-token="SD token address" data-chain="56" data-theme="dark" data-elevation="on"></div>

  <!-- SmartDeFi js script -->
  <script src="https://cdn.jsdelivr.net/gh/sdwidget/sd/js/sdwidget.js" defer></script>

  </body>
</html>

Custom Colors

Add the following style block at the end of your head section, right before the closing </head>

<style>
    /* Button Color */
    .sd-widget-toolbar-nav>div.sd-widget-toolbar-nav-active,
    .sd-widget-bottom button,
    .sd-widget-bottom button:hover{
        background-color: #872eff;
    }
    
    /* Background color for toggle button */
    .sd-widget-bottom button.Mui-disabled {
        background-color: #ccc;
    }
    
    /* Background color for disabled button */
    .sd-widget-bottom button.MuiIconButton-root {
        background-color: rgb(242, 244, 243);
    }
</style>

sd's People

Contributors

sdwidget avatar stedbrown avatar cryptojoshua 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.