Skip to content
This repository was archived by the owner on Aug 29, 2020. It is now read-only.
This repository was archived by the owner on Aug 29, 2020. It is now read-only.

Allows users to supply default props to components #13

@NickyMeuleman

Description

@NickyMeuleman

It would be neat if users of the plugin could provide their own default props to be used in the components this plugin supplies.

Proof of concept here: https://github.com/NickyMeuleman/gatsby-mdx-embed/tree/default-props

Eg. I want tweets to be dark mode, but don't want to add theme="dark" to every tweet I add.
Instead I provide some default props via my gatsby-config

module.exports = {
  plugins: [
    {
      resolve: "@pauliescanlon/gatsby-mdx-embed",
      options: {
        defaultProps: { Tweet: { theme: "dark" } },
      },
    },
  ],
}

This will merge supplied props with the plugin's defaults.
So the resulting default props would be

theme: "dark"
align: "left"

since align:"left" is a default used by the theme and not overwitten in gatsby-config.

Would you be interested in this feature/me PRing my branch against this one and supplying more default props (branch currently only merges options for CodePen and Tweet)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions