0.3.0 • Published 2 years ago

react-codepen-prefill v0.3.0

Weekly downloads
16
License
MIT
Repository
github
Last release
2 years ago

react-codepen-prefill

React component to create a button/link to prefill Codepen.io with supplied code.

Installation

npm install --save react-codepen-prefill

Usage

import React from 'react';
import CodepenPrefill from 'react-codepen-prefill';

...

  <CodepenPrefill
    label="Hello World"
    className="simple-link"
    target="_blank"
    title="CodepenPrefill Example"
    description="An example of the CodepenPrefill Component in action."
    js="console.log('hello world')"
    css="body{color: blue;}"
    html="<h1>Hello World</h1>"
    editors="111"
  />

For more examples: https://ronilan.github.io/react-codepen-prefill/

Component Props

Internal

PropertyTypeRequiredDefaultDescription
labelstringfalse''The text on the button/link
classNamestringfalse''The css class for the button/link
targetstringfalse''HTML target attribute

Passed to prefill a CodePen

PropertyTypeRequiredDefaultDescription
titlestringfalse''The title of the pen.
descriptionstringfalse''The description of the pen.
tagsarrayfalse[]An array of strings to act as tags.
editorsstringfalse'111'Which editors are open. 1 is open. order is: HTML, CSS, JS.
layoutstringfalse'left'Optional layouts: top, left, right
htmlstringfalse''The HTML code to fill in the HTML pane.
htmlPreProcessorstringfalse'none'Optional values: "none", "slim", "haml", "markdown"
cssstringfalse''The CSS code to fill in the CSS pane.
cssPreProcessorstringfalse'none'Optional values: "none", "less", "scss", "sass", "stylus"
cssStarterstringfalse'neither'Optional values: "normalize", "reset", "neither",
cssPrefixstringfalse'neither'Optional values: "autoprefixer", "prefixfree", "neither"
jsstringfalse''The JavaScript code to fill in the JS pane.
jsPreProcessorstringfalse'none'Optional values: "none", "coffeescript", "babel", "livescript", "typescript"
htmlClassesstringfalse''CSS class to apply to html tag.
headstringfalse''Content to include inside the HTML head tag.
cssExternalstringfalse''Use semi-colon to separate multiple files.
jsExternalstringfalse''Use semi-colon to separate multiple files.
privatebooleanfalsefalseOptional values: true, false - When the Pen is saved, it will save as Private if logged in user has that privledge, otherwise it will save as public
parentnumberfalsenullIf supplied, the Pen will save as a fork of this id. Note it's not the slug, but ID. You can find the ID of a Pen with window.CP.pen.id in the browser console.

Authors

Ron Ilan

License

MIT

Fabriqué au Canada : Made in Canada
0.3.0

2 years ago

0.2.3

2 years ago

0.2.2

3 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

6 years ago

0.1.0

6 years ago