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

gatsby-theme-flex

v0.4.1

Published

A Gatsby theme with flexible blocks for your Markdown pages.

Downloads

31

Readme

About

Flex is a Gatsby theme that ships with pre-built blocks that you can use in your Markdown pages. Then use Theme UI to customize the look and feel of your site.

See a demo

Features

  • Customizable - All blocks can be extended and customized.
  • Extendable - Build and add your own custom blocks.
  • Accessible - All blocks are tested for accessiblity.
  • Dark mode - Support for multiple color modes.
  • SEO - SEO + Open Graph out of the box.
  • Code Highlighting - Code highlighting with Prism.

Quick Start

Create a new Flex site:

gatsby new site arshad/gatsby-starter-flex

Start the development server

cd site
gatsby develop

You should now be able to view your site at http://localhost:8000.

Add a page

Create a page at content/pages/home/index.mdx and add the following to it:

---
title: Home
excerpt: Welcome to the home page
is_front: TRUE
---

This will create a new page and set it as the front page. If you head to http://localhost:8000, you should see Home displayed as the page title.

Add a block

Let's add a hero to the home page. Add the following to content/pages/home/index.mdx

---
title: Home
excerpt: Welcome to the home page
is_front: TRUE
---

<Hero
heading="Expedita Aperiam"
lead="Sint quaerat et occaecati voluptate illum tenetur."
imageUrl="https://via.placeholder.com/800x450"
style={{
    bg: "muted"
  }}
/>

It's that easy.

Available Blocks

Flex comes with a lot of pre-built blocks that you can use to build your site.

Cta, Div, Faqs, Feature, Hero, Logos, PageHeader, Section, Button, Card, Faq, Lead, Link, Logo, Image, Testimonial and many more.

Theming

Flex makes use of Theme UI under the hood. This makes it very easy to customize and re-use your theme across pages.

Customize the theme

Create a new file at src/gatsby-theme-flex/theme.js and add your custom theme values in there.

Let's change the default primary color.

// src/gatsby-theme-flex/theme.js
export default {
  colors: {
    primary: `#ee00ff`,
  },
}

Stop and restart the development server: gatsby develop.

FAQs

We're still working on the documentation. But here's some quick answers to get you started.

How to customize a block

Use Component Shadowing. Example, to override the Hero block, create the following file src/gatsby-theme-flex/blocks/hero.js and create your custom Hero block.

To customize the Header, create the following src/gatsby-theme-flex/layout/header.js.

How to add new props to a block

Shadow the block and add your new props. For example, the following code adds a foo prop to the card block:

// src/gatsby-theme-flex/components/card.js
/** @jsx jsx */
import { jsx } from "theme-ui"

export default ({ style, heading, foo, children }) => {
  ...
  {foo}
  ...
}

You can now use foo in your pages as follows:

<Card 
  heading="This is the heading" 
  foo="bar" 
/>

How to add your own block

Shadow the src/gatsby-theme-flex/blocks.js component and add the following code:

// src/gatsby-theme-flex/blocks.js
export * from "gatsby-theme-flex/src/blocks"
export { default as MyComponent } from "../my-component.js"
// src/my-component.js
/** @jsx jsx */
import { jsx } from "theme-ui"

export default ({ foo }) => <div>{foo}</div>

You can now use MyComponent in your pages:

<MyComponent foo="bar" />

Support

Need help? Create an issue on the main repo @arshad/gatsby-themes or ask me @arshadcn.

License