Skip to content
This repository has been archived by the owner on Dec 22, 2023. It is now read-only.

feat: overridable styles for AnnouncementsPage Component #27

Merged
merged 3 commits into from
Oct 8, 2023

Conversation

kurtaking
Copy link
Owner

@kurtaking kurtaking commented Oct 8, 2023

K-Phoen#154


The plugin does offer the ability to pass themeId, which allows us to customize the header of the AnnouncementsPage but unfortunately not the cards.

We would like to have some style customizations done in Card. So we made some of the UI components overridable in AnnouncementsPage by defining CSS properties (itemCardHeader, link), providing a name to the makeStyles function, making the styles overridable in the OverridableComponents.tsx file, and exporting the overrides from the plugin. The same pattern is used by the backstage catalog-react plugin to allow users to override component styles.

We can use it like this in the backstage app.

import { BackstageOverrides as AnnouncementsOverrides } from '@k-pheon/backstage-plugin-announcements';
import { BackstageOverrides } from '@backstage/core-components';

const createCustomThemeOverrides = (): BackstageOverrides & AnnouncementsOverrides => {
  return {
    AnnouncementsStylePicker: {
      itemCardHeader: {
        // custom styles
      },
      cardHeader: {
        // custom styles
      },
      link: {
        // custom styles
      },
    },
  };
};

@kurtaking kurtaking self-assigned this Oct 8, 2023
@kurtaking kurtaking merged commit fe515d0 into kurtaking:main Oct 8, 2023
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants