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

@hawkstein/gatsby-theme-schedule

v0.2.1

Published

A Gatsby Theme for displaying events scheduled over a few days

Downloads

2

Readme

gatsby-theme-schedule

Gatsby Theme Schedule

Examples

Getting started

To get started you can either clone this starter gatsby-schedule-starter or follow the instructions below.

Install

yarn add @hawkstein/gatsby-theme-schedule

or

npm install @hawkstein/gatsby-theme-schedule

Install Peer Dependencies

yarn add gatsby gatsby-plugin-mdx gatsby-source-filesystem react react-dom @mdx-js/mdx @mdx-js/react gatsby-plugin-mdx @emotion/core @emotion/styled theme-ui gatsby-plugin-theme-ui gatsby-plugin-sharp gatsby-remark-images gatsby-transformer-sharp gatsby-image

or

npm install gatsby gatsby-plugin-mdx gatsby-source-filesystem react react-dom @mdx-js/mdx @mdx-js/react gatsby-plugin-mdx @emotion/core @emotion/styled theme-ui gatsby-plugin-theme-ui gatsby-plugin-sharp gatsby-remark-images gatsby-transformer-sharp gatsby-image

Woah! That's a lot of peer dependencies! Well, this is a Gatsby Theme so chances are you'll be installing these as part of combining this theme with other themes and plugins.

Setup

gatsby-config.js

Add @hawkstein/gatsby-theme-schedule to your gatsby-config.js

// gatsby-config.js
module.exports = {
  plugins: ['@hawkstein/gatsby-theme-schedule']
}

Theme options

Example

// gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: '@hawkstein/gatsby-theme-schedule',
      options: {
        heading: "Example Event",
        locationsOrder: [`Main Location`, `Location Two`, `Location Three`],
      }
    }
  ]
}

| Option | Default | Description | | ------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------ | | basePath | "/" | The base path which the theme will start at | | collection | "events" | Name for this specific collection of events | | useCollectionInURLs | false | If set to true then the collection option will be prefixed in front of day and event slugs | | contentPath | "src/events" | The location of the MDX files which will generate the event pages and day pages | | heading | "Events Schedule" | Title used in the header component | | locationsOrder | [] | An array of strings, this is used to create a custom sort for your locations | | locationsLabel | "Locations" | Label for the locations link in the header | | locationsSlug | "locations" | The slug to use as part of the url for the link in the header | | scheduleLabel | "Schedule" | Label for the schedule link in the header | | scheduleSlug | "schedule" | The slug to use as part of the url for the link in the header | | use24Hour | true | Should the theme use 24 hour times | | navLinks | [] | Array of objects of type { label: string, url: string } | | footerLinks | [] | Array of objects of type { label: string, url: string } | | actionLabel | "Buy Tickets" | Label for the call to action button in the header | | actionURL | "/buy" | URL for the call to action button in the header | | remarkImageOptions | { maxWidth: 1200, withWebp: true } | Object to pass to 'gatsby-remark-images' plugin |

Source data directory setup

To add events create .mdx files in the src/events directory. The source directory can be adjusted by setting the plugin option contentPath.

|-- src
    |-- events
        |-- my-event.mdx
        |-- my-other-event.mdx
        |-- another-event.mdx
        |-- the-last-event.mdx

MDX Pages Setup

Pages must include date and start in the frontmatter. You'll probably to include location too but if it's omitted from all of the mdx then it will be ignored.

// src/events/my-event.mdx
---
date: 6/11/81
start: 18:00
location: Main Location
---

# My Event

Content for the event page. Any valid markdown / mdx will work here!

As the .mdx files are parsed by Gatsby, source nodes for all the events days and locations will be generated.

Theme UI Components

The theme is using theme-ui for layout and so anything provided by theme-ui/components is going to fit in.

Shadowing gatsby-theme-schedule Components

The first thing to shadow is your logo.

|-- src
    |-- @hawkstein
      |-- gatsby-theme-schedule
        |-- src
          |-- components
            |-- logo.tsx

If you would like to customize any part of the theme you can do so by shadowing the theme file. Perhaps layout.tsx or its children header.tsx or footer.tsx.

To do this create the following directory src/gatsby-plugin-theme-ui and then create an index.js

// src/gatsby-plugin-theme-ui/index.js

import baseTheme from "@hawkstein/gatsby-theme-schedule/src/theme.js"

export default {
  ...baseTheme,
  colors: {
    ...baseTheme.colors,
    primary: "#EEE",
    background: "#000",
  },
}

Theme creates a redirect from /schedule to the 1st day of the schedule, if you want this to be implemented by your host then you should use the relevant plugin (e.g. Netlify plugin)

Theme Options

Theme Options set in gatsby-config are available via a custom hook exported as useScheduleOptions

Development

gatsby-theme-schedules uses yarn workspaces for development. Clone and run yarn && yarn develop.

Thanks!

Thanks for making it this far and checking out my theme, if you have any thoughts or comments then please get in touch. @liamhawks @hawkstein