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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-clouds-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@k-phoen/backstage-plugin-announcements': minor
---

Overridable styles for AnnouncementsPage Component
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ import { useDeleteAnnouncementDialogState } from './useDeleteAnnouncementDialogS
import { Pagination } from '@material-ui/lab';
import { ContextMenu } from './ContextMenu';

export type AnnouncementsStylePickerClassKey =
| 'itemCardHeader'
| 'cardHeader'
| 'link';

const useStyles = makeStyles(theme => ({
cardHeader: {
color: theme.palette.text.primary,
Expand All @@ -57,7 +62,17 @@ const useStyles = makeStyles(theme => ({
justifyContent: 'center',
marginTop: theme.spacing(4),
},
}));
itemCardHeader: {

},
link: {

},
}),
{
name: 'AnnouncementsStylePicker',
},
);

const AnnouncementCard = ({
announcement,
Expand Down Expand Up @@ -85,7 +100,7 @@ const AnnouncementCard = ({
<>
By{' '}
<EntityPeekAheadPopover entityRef={announcement.publisher}>
<Link to={entityLink(publisherRef)}>{publisherRef.name}</Link>
<Link to={entityLink(publisherRef)} className={classes.link}>{publisherRef.name}</Link>
</EntityPeekAheadPopover>
{announcement.category && (
<>
Expand All @@ -109,7 +124,7 @@ const AnnouncementCard = ({
return (
<Card>
<CardMedia>
<ItemCardHeader title={title} subtitle={subTitle} />
<ItemCardHeader title={title} subtitle={subTitle} classes={{root : useStyles().itemCardHeader}}/>
</CardMedia>
<CardContent>{announcement.excerpt}</CardContent>
<CardActions>
Expand Down
13 changes: 13 additions & 0 deletions plugins/announcements/src/components/OverridableComponents.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Overrides } from '@material-ui/core/styles/overrides';
import { StyleRules } from '@material-ui/core/styles/withStyles';
import { AnnouncementsStylePickerClassKey } from './AnnouncementsPage/AnnouncementsPage';

export type AnnouncementsNameToClassKey = {
AnnouncementsStylePicker: AnnouncementsStylePickerClassKey;
};

export type BackstageOverrides = Overrides & {
[Name in keyof AnnouncementsNameToClassKey]?: Partial<
StyleRules<AnnouncementsNameToClassKey[Name]>
>;
};
1 change: 1 addition & 0 deletions plugins/announcements/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './plugin';
export * from './components/OverridableComponents';