Coder Social home page Coder Social logo

styled-react-gist's Introduction

styled-react-gist

Upgraded rewrite of react-gist created by Tommy. Credit goes out to those who helped build that library.

NPM react code language: typescript

This rewrite:

  • Adds native TS support
  • Adds Styling feature ( url || raw css )

Why use styled-react-gist ?

  • the fastest library to embed themed code snippets in your website
  • because we care about your bundle size <3

How it works

This package embeds styled github gists in react applications, the styles currently can be imported with a url of a css file [DOMAIN_NAME]/[FILE_NAME].css and/or raw css ( refer to this example )
If both methods were used, the styles specified in cssString will override the ones, if mentioned, imported with a url. This will allow applying adjustments to an open source (coming soon) css file :)

๐Ÿš€ Installation

npm i styled-react-gist
yarn add styled-react-gist

โœจ Usage

import React from "react";
import Gist from "styled-react-gist";

export const YourComponent = () => {

  const cssString = `
    .js-file-line-container {
      background : whitesmoke !important;
    }
    .gist-meta{
      display : none !important
    }
    .gist-data {
      background : whitesmoke !important;
      padding : 1rem 0.5rem !important;
      // background: transparent !important;
    }
  `;

  return (
    <Gist
      gistId = '189e5c6bbc7217b8bdf952ff243c2411'
      file = 'styled-react-gist.jsx'
      gistUrl = 'https://gist.github.com/hammamikhairi/189e5c6bbc7217b8bdf952ff243c2411'

      cssString = {cssString}
      styleSheetUrl = "https://pleasedont.hammamikhairi.repl.co/css/npm.css"
    />
  );
};

The component will render :

๐Ÿ“Œ Props

Prop Type Description Required
file string Name of the gist's file (if the gist has many file, pick any of them)
avoid using special Characters
Yes
gistId string gist's id Yes (if url isn't specified)
gistUrl string gist's url Yes (if gistId isn't specified)
cssString string a string containing css (refer to this example) No
styleSheetUrl string a url to a .css file No

โœŒ๏ธ License

MIT

styled-react-gist's People

Contributors

hammamikhairi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

alirazahub

styled-react-gist's Issues

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.