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-pod-connector

v0.1.41

Published

A simple react component to connect Solid pods to your website.

Downloads

20

Readme

React Pod Connector

A simple login (with Solid) flow for React applications.

Demo

✅ Recommended & Custom Identity Provider Logins ✅ Customizable app logo and name ✅ Can be triggered manually (per-page) or automatically ✅ Allows users to save login info for future logins ✅ Dark Mode (lol)

Overview | Usage | Reference

Overview

This library is designed for you to save time when you start building a new Solid application in React.

In it's default configuation it will show a Solid logo and give popular options for Identity Providers like Inrupt's ESS or the Solid Community's NSS, as well as the option to enter a custom IDP login URL (with or without https://).

The component also allows users to easily save login info for the future.

Usage

Use yarn add react-pod-connector or npm install react-pod-connector to install.

You can wrap your entire app in this component to always automatically connect users with their pods:

// App.tsx
import { PodConnector } from "react-pod-connector"

function App() {
  return (
    <PodConnector>
      <div>Hello World</div>
    </PodConnector>
  )
}

Or you can manually trigger the login flow on private pages by adding a route "middleware" to your react router configuration:

// PrivateRoute.tsx
import { useConnect } from "react-pod-connector"

interface PrivateRouteProps {
  page: JSX.Element
}

export const PrivateRoute: React.FC<PrivateRouteProps> = ({ page }) => {
  const { session } = useConnect()

  if (session) {
    return page
  } else {
    return <></>
  }
}
// App.tsx
import PrivateRoute from "./PrivateRoute"

const routes = [
  {
    path: "/",
    element: <div>Hello World! This is a public page</div>,
  },
  {
    path: "/private",
    element: (
      <PrivateRoute page={<div>Hello World! This is a private page</div>} />
    ),
  },
]

function App() {
  const router = createBrowserRouter(routes)

  return (
    <PodConnector auto={false}>
      <RouterProvider router={router} />
    </PodConnector>
  )
}

Reference

These are all the customizable props and their defaults: | name | default | description | | ------ | ------ | ------ | | auto | true | Determines whether the component automatically logs in users or waits for the flow to be triggered | | name | Solid Login | The display name of the application | | logo | Logo of the Solid project | The logo that is displayed | | lead | Choose an identity provider for this Solid application | The text that is displayed on top of the login form | | loadingIndicator | - | The loading indicator that is shown when the page first loads or when a session is being restored. | | recommendedLogins | ["https://login.inrupt.com", "https://solidcommunity.net"] | A list of login options that are presented to the user as "recommended" | | loginOptions | null | The login options with which to call the login function (see Inrupt's documentation). |