Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Unable to change graphics assets for admin

default discord avatar
the_light_bearerlast year
3
  admin: {
    user: Users.slug,
    meta: {
      titleSuffix: "- QS I-GAUGE",
      icons: [
        {
          rel: "icon",
          type: "image/svg",
          url: "/favicon.svg",
        },
      ],
      defaultOGImageType: "static",
      openGraph: {
        images: [
          {
            url: "/logo.svg",
          },
        ],
      },
    },
    components: {
      graphics: {
        Logo: Logo,
        Icon: Icon,
      },
    },
  },


const Logo = () => {
  return (
    <div className="logo">
      <img src="/logo.svg" alt="Igauge" />
    </div>
  );
};

export default Logo;

here is an example of what I tried to do which is pretty close to what the documentation suggests I believe but I get the error


TS2322: Type () => React. JSX. Element is not assignable to type
CustomComponent<Record<string, any>> | undefined

Any idea on how to fix this?

  • default discord avatar
    zed0547last year

    Hey

    @1014589523247771679

    ,



    Payload v3 changed the way in which custom components get referenced in configs to allow more flexible and powerful patterns here, such as rendering them out on the server on demand.



    In v3, to import a custom component, you're going to want to pass the path to your custom component instead of importing them into config.



    Try this instead:


    ...
    components: {
      graphics: {
        Logo: '/path/to/Logo',
        Icon: '/path/to/Icon',
      },
    },


    See here:

    https://payloadcms.com/docs/admin/components#defining-custom-components
  • default discord avatar
    the_light_bearerlast year

    ohh did not read on it, my bad will give it a try



    @654031862146007055

    also thanks for the response

  • default discord avatar
    zed0547last year

    My pleasure

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.