npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-designer-component

v1.0.6

Published

A server side renderable react designer canvas component. You can add images, add texts, draw circles .. etc in this canvas.

Downloads

6

Readme



A server side renderable react canvas.

Features

  • Get all items as objects
  • Add texts, images, rectangles and circles
  • You can draw your own shapes by using lines and brush
  • Enable or disable features

Watch Demo >>

Installation

You can install this component using yarn or npm

//yarn
$ yarn add react-designer-component

//npm
$ npm install react-designer-component --save

Usage

import Designer from 'react-designer-component';

...
class App extends Component {

 constructor(props){
	super(props);

	this.state = {items:[]}
 }

 handleChangeItems = (items)=>{
 	this.setState({items})
 }

 render(){
	return (
		<Designer
			items={items}
			onChangeItems={this.handleChangeItems}
			fontApiKey="API_KEY"
			paperSize={{
				height: 300,
				width: 600
			}}
		/>
	)
 }
}

Documentation

Please provide following props.

| Prop | Description | Type | | ------------- |:-------------:| -----:| | *items | If you want to initialize the designer with a blank page provide an empty array. Otherwise provide an array with DesignerItems | Array with ImageItem, CircleItem, RectangleItem, LineItem, TextItem, BrushItem | | *onChangeItems | This callback function will calling when changing items. | (items:DesignerItem)=>void | | className | CSS class name to apply the for the root element | string | | features | You can enable/disable features by passing an object. | Object that containing boolean values for text,brush,image,circle,rectangle,line properties. All properties are optional. | | classes | You can override all CSS classes by passing an Object | Please look at this file to see all CSS classes. All properties are optional. | |fontApiKey| Google Font API Key if you using the text feature. All fonts loading from google.| string | |paperSize| Size of the paper. | Object with width:number and height:number properties. Default values are 300 pixel height and 600 pixel width. | |drawingArea| Supply coordinates of a polygon if you want a custom shape other than a rectangle. | Array of positions. Ex:- [{left:300,right:400},...] |

ImageItem

You can find following properties in an image item.

  • rotate:number Current degree value
  • outlineColor:string Color of the outline as a rgba string. `rgba(210,210,120,0.7)
  • outlineWeight:number Weight of the outline as a pixel value.
  • position: Position Current position of the image. This object has two properties named left and top that contains the coordinate data in pixel values.
  • size:Object Current size of the image. This object contains width:number, height:number properties in pixel values.
  • data:string Base 64 encoded original image
  • naturalSize:Object This property is like size property. But this object contains size of the original image.

CircleItem

This item containing rotate,outlineColor,outlineWidth,position,size properties like ImageItem. And additionally this item has a property called color:string that contains the fill color as a rgba value.

RectangleItem

All properties is similiar to the CircleItem.

LineItem

Also LineItem containing the rotate,position,outlineColor,OutlineWeight properties and a property called width:number that containing the width of the line in pixels.

BrushItem

BrushItem also has the rotate,position,outlineColor,OutlineWeight properties and an array of brush spot positions in positions:Position[] property.

TextItem

TextItem has rotate,position,color properties.

  • text:string Typed text in the text box.
  • fontName:string Name of the font family.
  • fontSize:number Font size in pixels.
  • underline:bool,italic:bool,bold:bool properties containing the font styles.

Developing

  1. Clone the repository
$ git clone https://github.com/whizsid/react-designer-component`
  1. Install the dependencies
$ cd react-designer-component
$ yarn
  1. Start the development server
yarn start

Contributing

Please lint your code before made a PR.

$ yarn lint

Always follow prettier code styles and check before making your PR.

$ yarn prettier

I will reply to all PRs when I have a free time. Issues and stars also welcome.