Skip to content
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/fix-heading-secondary-color.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"spectacle": patch
---

Fix Heading component not applying secondary color styling. Restores correct theme color for headings that was lost in v10.2.2 when replacing defaultProps with attrs method.
5 changes: 5 additions & 0 deletions packages/spectacle/src/components/typography.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ describe('<Heading />', () => {
const { getByText } = mountWithTheme(<Heading>Spectacle!</Heading>);
expect(getByText('Spectacle!')).toHaveStyle({ fontSize: 'h1' });
});

it('should apply the secondary color from theme', () => {
const { getByText } = mountWithTheme(<Heading>Spectacle!</Heading>);
expect(getByText('Spectacle!')).toHaveStyle({ color: '#fc6986' });
});
});

describe('<Quote />', () => {
Expand Down
5 changes: 3 additions & 2 deletions packages/spectacle/src/components/typography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ const Link = styled.a.attrs<CommonTypographyProps & DecorationProps>(
compose(color, typography, space, decoration)
);

const Heading = styled(Text).attrs<CommonTypographyProps>((props) => ({
const Heading = styled.div.attrs<CommonTypographyProps>((props) => ({
color: 'secondary',
fontFamily: 'header',
fontSize: 'h1',
fontWeight: 'bold',
textAlign: 'center',
margin: 1,
padding: 0,
...props
}))<CommonTypographyProps>({});
}))<CommonTypographyProps>(compose(color, typography, space));

const Quote = styled(
Text as FC<
Expand Down