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-photo-albums

v1.0.3

Published

A photo albums theme for Gatsby

Downloads

10

Readme

With this theme, you may add some photo albums to your Gatsby site. The albums are generated from folders and image files that are placed within a specific directory. To see the theme in action, check out this demo.

Installation

  1. Set up a Gatsby site.

  2. Install the theme

    npm i gatsby-theme-photo-albums

    or

    yarn add gatsby-theme-photo-albums
  3. Add the theme to your gatsby-config.js:

    module.exports = {
      plugins: [
        {
          resolve: "gatsby-theme-photo-albums",
        }
      ]
    }

Configuration

If you want to change the default behavior, add some options to gatsby-config.js:

module.exports = {
  plugins: [
    {
      resolve: "gatsby-theme-photo-albums",
      options: {
        baseUrl: '/', // the path to the photo albums from your site (default: '/')
        photosPerPage: 15, // the number of photos to display on a page (default: 15)
        albumsPath: 'photo-albums', // the directory where you put photo albums (default: 'photo-albums')
        folderIconDir: folder-icon // the directory containing a custom folder icon (do not specify the file name)
      }
    }
  ]
}

Adding Photo Albums

Add some folders and image files to your albums directory. The default directory is photo-albums, but this can be changed with the albumsPath configuration option. Each folder you create inside the albums directory is a photo album.

Customizing Styles

This theme utilizes gatsby-plugin-theme-ui, which makes it easy to override CSS styles provided by the theme. If you want to change the styles provided by this theme, create a src/gatsby-theme-photo-albums directory in your site and add a file called theme.js to the directory. To override the styles, you will want to do a deep merge of the original styles object. One way to do this merge is to use Lodash merge function.

To install the Lodash merge function:

npm i lodash.merge

or

yarn add lodash.merge

Here is an example of a style customization, where the default background color is changed, by using the Lodash merge function in the src/gatsby-theme-photo-albums/theme.js file:

import merge from 'lodash.merge'
import baseTheme from 'gatsby-theme-photo-albums/src/theme'

export const theme = merge({}, baseTheme, {
  colors: {
    background: '#eee',
  },
})

export default theme

The default styles can be seen in the src/theme.js file of the gastsby-theme-photo-albums theme.

Component Shadowing

Thanks to Gatsby's awesome Component Shadowing functionality, you may override any component provided by gatsby-theme-photo-albums. For example, you may change the text of the "Next Page" pagination link, by implementing your own custom PreviousPageText component. To override PreviousPageText, add the following code to a file called src/gatsby-theme-photo-albums/components/pagination/PreviousPageText.js:

import React from 'react'

const NextPageText = () => 
  <span className='next-page'>
    Siguiente →
  </span>

export default NextPageText

In the example above, the text of the "Next Page" pagination link was changed from English to Spanish. To see other components that may be overriden with Component Shadowing, look in the src directory of the gatsby-theme-photo-albums theme.