Skip to content

Commit

Permalink
fix(core): rename studioAnnouncements subtitle to preHeader
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrobonamin committed Sep 23, 2024
1 parent 51defa8 commit c85bd1b
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ interface StudioAnnouncementCardProps {
id: string
name: string
isOpen: boolean
subtitle: string
preHeader: string
onCardClick: () => void
onCardDismiss: () => void
}
Expand All @@ -95,7 +95,7 @@ export function StudioAnnouncementsCard({
id,
isOpen,
name,
subtitle,
preHeader,
onCardClick,
onCardDismiss,
}: StudioAnnouncementCardProps) {
Expand Down Expand Up @@ -139,7 +139,7 @@ export function StudioAnnouncementsCard({
<Stack space={3}>
<Box marginRight={6}>
<Text as={'h3'} size={1} muted>
{subtitle}
{preHeader}
</Text>
</Box>
<Text size={1} weight="medium">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export function StudioAnnouncementsProvider({children}: StudioAnnouncementsProvi
{children}
{unseenAnnouncements.length > 0 && (
<StudioAnnouncementsCard
subtitle={unseenAnnouncements[0].subtitle}
preHeader={unseenAnnouncements[0].preHeader}
title={unseenAnnouncements[0].title}
name={unseenAnnouncements[0].name}
id={unseenAnnouncements[0]._id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jest.mock('../../../version', () => ({
const announcementCardProps = {
title: 'New Features Available',
id: 'foo',
subtitle: "What's new",
preHeader: "What's new",
name: 'new-features',
} as const

Expand Down Expand Up @@ -73,24 +73,24 @@ describe('StudioAnnouncementsCard', () => {
expect(screen.getByText("What's new")).toBeInTheDocument()
expect(screen.getByText(announcementCardProps.title)).toBeInTheDocument()
})
test('renders a different subtitle', async () => {
test('renders a different preHeader', async () => {
const onCardClickMock = jest.fn()
const onCardDismissMock = jest.fn()

const subtitle = 'Check out the new features'
const preHeader = 'Check out the new features'
const wrapper = await createAnnouncementWrapper()
render(
<StudioAnnouncementsCard
{...announcementCardProps}
subtitle={subtitle}
preHeader={preHeader}
isOpen
onCardClick={onCardClickMock}
onCardDismiss={onCardDismissMock}
/>,
{wrapper},
)

expect(screen.getByText(subtitle)).toBeInTheDocument()
expect(screen.getByText(preHeader)).toBeInTheDocument()
expect(screen.getByText(announcementCardProps.title)).toBeInTheDocument()
})
test('does not render when isOpen is false', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const MOCKED_ANNOUNCEMENTS: StudioAnnouncementDocument[] = [
_updatedAt: '',
title: 'Announcement 1',
name: 'announcement-1',
subtitle: "What's new",
preHeader: "What's new",
body: [
{
_type: 'block',
Expand Down Expand Up @@ -72,7 +72,7 @@ const MOCKED_ANNOUNCEMENTS: StudioAnnouncementDocument[] = [
_updatedAt: '',
title: 'Announcement 2',
name: 'announcement-2',
subtitle: "What's new",
preHeader: "What's new",
body: [
{
_type: 'block',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const MOCKED_ANNOUNCEMENT: StudioAnnouncementDocument = {
publishedDate: '2024-09-10T14:44:00.000Z',
audience: 'everyone',
name: 'announcement-1',
subtitle: "What's new",
preHeader: "What's new",
}
const useStudioAnnouncementsMock = useStudioAnnouncements as jest.Mock<
typeof useStudioAnnouncements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const mockAnnouncements: StudioAnnouncementDocument[] = [
title: 'Announcement 1',
body: [],
announcementType: 'whats-new',
subtitle: "What's new",
preHeader: "What's new",
publishedDate: '2024-09-10T14:44:00.000Z',
audience: 'everyone',
name: 'announcement-1',
Expand All @@ -90,7 +90,7 @@ const mockAnnouncements: StudioAnnouncementDocument[] = [
title: 'Announcement 2',
body: [],
announcementType: 'whats-new',
subtitle: "What's new",
preHeader: "What's new",
publishedDate: '2024-09-10T14:44:00.000Z',
audience: 'everyone',
name: 'announcement-2',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface StudioAnnouncementDocument {
| 'below-than-or-equal-version'
audienceRole?: AudienceRole[] | undefined
studioVersion?: string
subtitle: string
preHeader: string
}

export interface StudioAnnouncementsContextValue {
Expand Down

0 comments on commit c85bd1b

Please sign in to comment.