Skip to content

Instantly share code, notes, and snippets.

@elrumordelaluz
Created May 17, 2017 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elrumordelaluz/3350686e9868ca2e18acb779cd8287bb to your computer and use it in GitHub Desktop.
Save elrumordelaluz/3350686e9868ca2e18acb779cd8287bb to your computer and use it in GitHub Desktop.
import React from 'react'
import { CodepenIcon } from '../icons'
const CodepenButton = ({ code, className }) => {
const codepenObject = {
title: 'Title',
description: 'Some description',
editors: '100',
...code,
}
return (
<form
className={className}
action="https://codepen.io/pen/define"
method="POST"
target="_blank">
<input
type="hidden"
name="data"
value={JSON.stringify(codepenObject)} />
<button style={buttonStyles}>
<CodepenIcon />
</button>
</form>
)
}
const buttonStyles = {
border: 0,
outline: 0,
background: 'none',
width: '100%',
height: '100%',
color: 'inherit',
cursor: 'pointer',
}
export default CodepenButton
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment