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

editmode-react-staging

v1.0.0

Published

Convert slices of content in your React app into inline-editable Editmode chunks.

Downloads

1

Readme

Editmode for React

Editmode allows you to turn plain text in your React app into easily inline-editable bits of content that can be managed by anyone with no technical knowledge.

Installation

Use npm to install Editmode:

npm install editmode-react

Usage

Step 1:

Within your React app, navigate to the index file within your src directory. Import the Editmode wrapper and wrap your App within.

import { Editmode } from "editmode-react";

// 👉 `project_id` can be found in the URL:
// https://editmode.com/projects/{project_id}/chunks

ReactDOM.render(
  <React>
    <Editmode projectId={project_id}>
      <App />
    </Editmode>
  </React>,
  document.getElementById("root")
);

Step 2:

Rendering a chunk:

If you have already created the chunk you would like to render on the Editmode CMS, you can simply pass the identifier as a prop and begin editing. You can provide default content as a fallback should anything go wrong trying to retrieve the data from the API:

import { Chunk } from "editmode-react";

function Example() {
  return (
    <div>
      <p>
        <Chunk identifier="cnk_123" />
      </p>
      <p>
        <Chunk identifier="cnk_321"> I have default content </Chunk>
      </p>
    </div>
  );
}

Alternatively, if you are using one of our text editor plugins and would like to create a new chunk directly from the editor, you may select the piece of text you would like to convert and hit CMD+SHIFT+L. (For Visual Studio Code users, you can also hit CMD+SHIFT+P to open the command palette, type "Editmode: Create Chunk" and hit enter).

Rendering a chunk collection:

Chunk collections are simply a way to categorise chunks and can be used to render repeatable content. Each collection can contain many properties and each property can hold different types of information.

A good use case example would be creating a "Team Member" collection. It may have Full Name, Title and Headshot properties. Within your React app, you may want to display the name, title and headshot of all your team members (ie all chunks within the Team Member collection). You can do this by passing the chunk collection identifier as a prop to the ChunkCollection component. To render the name, title and headshot for each team member, pass the identifiers for each property as a prop to the ChunkFieldValue component:

import { ChunkCollection, ChunkFieldValue } from "editmode-react";

function Example() {
	return (
	   <section className="meet_the_team">
	       <ChunkCollection identifier="lst_123" className="team_member">
		  <h2> <ChunkFieldValue identifier="prop_001" className="name"/> <h2>
		  <h5> <ChunkFieldValue identifier="prop_002" className="title"/> </h5>
		  <ChunkFieldValue identifier="prop_003" className="headshot"/>
	       </ChunkCollection>
	   </section>
	);
}

This will render editable headings containing the name and title and an image containing the headshot for every person in the "Team Member" collection.

Step 3:

You can now edit and save all of the chunks in your React app from within the browser - just add editmode=1 as a query string parameter to the current URL.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!