Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Typography] Add primary option to color property #8440

Merged
merged 2 commits into from
Sep 28, 2017
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Typography/Typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ export const styles = (theme: Object) => ({
colorInherit: {
color: 'inherit',
},
colorPrimary: {
color: theme.palette.primary[500],
},
colorSecondary: {
color: theme.palette.text.secondary,
},
Expand Down Expand Up @@ -95,7 +98,7 @@ export type Props = {
/**
* The color of the component. It's using the theme palette when that makes sense.
*/
color?: 'inherit' | 'secondary' | 'accent' | 'default',
color?: 'inherit' | 'primary' | 'secondary' | 'accent' | 'default',
/**
* If `true`, the text will have a bottom margin.
*/
Expand Down
13 changes: 13 additions & 0 deletions src/Typography/Typography.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,19 @@ describe('<Typography />', () => {
});
});

[
['primary', 'colorPrimary'],
['secondary', 'colorSecondary'],
['accent', 'colorAccent'],
['inherit', 'colorInherit'],
].forEach(([color, className]) => {
it(`should render ${color} color`, () => {
const wrapper = shallow(<Typography color={(color: any)}>Hello</Typography>);
assert.ok(classes[className] !== undefined);
assert.strictEqual(wrapper.hasClass(classes[className]), true, `should be ${color} text`);
});
});

describe('prop: color', () => {
it('should inherit the color', () => {
const wrapper = shallow(<Typography color="inherit">Hello</Typography>);
Expand Down