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

@urbit/foundation-design-system

v0.7.5

Published

A system of design variables, Markdoc and React components intended for Urbit Foundation projects.

Downloads

5

Readme

@urbit/foundation-design-system

A system of design variables, Markdoc and React components intended for Urbit Foundation projects.

Usage

We build all our sites with Next.js and Tailwind and this package is designed for those scenarios. Please be advised you will need a Next.js installation to make use of these components.

npm i @urbit/foundation-design-system

Ensure all peer dependencies are present as well:

npm i @tailwindcss/aspect-ratio tailwindcss-theme-swapper autoprefixer postcss prismjs tailwindcss next

Tailwind config and other CSS styles

Our design variables are available by using the Tailwind config in your own installation as a preset, ensuring you style our components as well in the content section:

presets: [require("@urbit/foundation-design-system/tailwind")],
content: [
  "./node_modules/@urbit/foundation-design-system/**/*.js",
  "./pages/**/*.{js,ts,jsx,tsx}",
  "./components/**/*.{js,ts,jsx,tsx}",
],

Likewise you can find our CSS styles by importing them at the top of your site build (i.e. _app.js):

import "@urbit/foundation-design-system/styles/globals.css";
import "@urbit/foundation-design-system/styles/markdown.css";
import "@urbit/foundation-design-system/styles/prism.css";

Markdown parser, renderer, and components

We use Markdoc to allow for embedding dynamic React components inside Markdown files. For a sample of our components and how to use them in your own Markdown, see here.

Our Markdown parser is a custom patched installation of Markdoc for additional features (basic footnote support, superscript, next/link injection, inline HTML injection).

Import the component:

import Markdown from '@urbit/foundation-design-system'; 

Then, on the server-side parse your content by passing it an object in the following shape:

{ post: { content: "## A markdown document"}}

If you've extracted the content directly with gray-matter reconstruct the object:

const markdown = JSON.stringify(Markdown.parse({ post: { content } }));

Otherwise this works fine if you're just using getPostBySlug a la urbit.org:

const markdown = JSON.stringify(Markdown.parse(post));

And on front-end pass it to the renderer:

<div className="markdown">
    <Markdown.render content={JSON.parse(markdown)} />
</div>

Why are we doing JSON stringification and parsing? you ask. The wind answers, and you feel the breeze on the back of your neck.