Skip to content

Commit

Permalink
[docs] More detailed palette documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Jan 20, 2018
1 parent 0724dad commit 903c87a
Show file tree
Hide file tree
Showing 26 changed files with 137 additions and 144 deletions.
3 changes: 2 additions & 1 deletion docs/src/modules/components/Demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const styles = theme => ({
},
},
demo: theme.mixins.gutters({
backgroundColor: theme.palette.background.contentFrame,
backgroundColor:
theme.palette.type === 'light' ? theme.palette.grey[200] : theme.palette.grey[900],
display: 'flex',
justifyContent: 'center',
paddingTop: theme.spacing.unit * 2,
Expand Down
7 changes: 4 additions & 3 deletions docs/src/modules/components/MarkdownElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const styles = theme => ({
overflow: 'hidden',
},
'& thead': {
fontSize: 12,
fontSize: 13,
fontWeight: theme.typography.fontWeightMedium,
color: theme.palette.text.secondary,
},
Expand All @@ -156,7 +156,7 @@ const styles = theme => ({
color: theme.palette.text.primary,
},
'& td': {
borderBottom: `1px solid ${theme.palette.text.lightDivider}`,
borderBottom: `1px solid ${theme.palette.line.divider}`,
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 2}px ${theme.spacing.unit}px ${
theme.spacing.unit
}px`,
Expand All @@ -174,7 +174,8 @@ const styles = theme => ({
},
'& th': {
whiteSpace: 'pre',
borderBottom: `1px solid ${theme.palette.text.lightDivider}`,
borderBottom: `1px solid ${theme.palette.line.divider}`,
fontWeight: theme.typography.fontWeightMedium,
padding: `0 ${theme.spacing.unit * 2}px 0 ${theme.spacing.unit}px`,
textAlign: 'left',
},
Expand Down
6 changes: 5 additions & 1 deletion docs/src/pages/demos/dividers/ListDividers.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ function ListDividers(props) {
<ListItem button>
<ListItemText primary="Inbox" />
</ListItem>
<Divider light />
<Divider />
<ListItem button>
<ListItemText primary="Drafts" />
</ListItem>
<Divider />
<ListItem button>
<ListItemText primary="Trash" />
</ListItem>
<Divider light />
<ListItem button>
<ListItemText primary="Spam" />
</ListItem>
</List>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const styles = theme => ({
flexBasis: '33.3%',
},
helper: {
borderLeft: `2px solid ${theme.palette.text.lightDivider}`,
borderLeft: `2px solid ${theme.palette.line.divider}`,
padding: `${theme.spacing.unit}px ${theme.spacing.unit * 2}px`,
},
link: {
Expand Down
10 changes: 5 additions & 5 deletions docs/src/pages/demos/menus/ListItemComposition.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ const styles = theme => ({
menuItem: {
'&:focus': {
backgroundColor: theme.palette.primary.main,
'& $text, & $icon': {
'& $primary, & $icon': {
color: theme.palette.common.white,
},
},
},
text: {},
primary: {},
icon: {},
});

Expand All @@ -31,19 +31,19 @@ function ListItemComposition(props) {
<ListItemIcon className={classes.icon}>
<SendIcon />
</ListItemIcon>
<ListItemText classes={{ text: classes.text }} inset primary="Sent mail" />
<ListItemText classes={{ primary: classes.primary }} inset primary="Sent mail" />
</MenuItem>
<MenuItem className={classes.menuItem}>
<ListItemIcon className={classes.icon}>
<DraftsIcon />
</ListItemIcon>
<ListItemText classes={{ text: classes.text }} inset primary="Drafts" />
<ListItemText classes={{ primary: classes.primary }} inset primary="Drafts" />
</MenuItem>
<MenuItem className={classes.menuItem}>
<ListItemIcon className={classes.icon}>
<InboxIcon />
</ListItemIcon>
<ListItemText classes={{ text: classes.text }} inset primary="Inbox" />
<ListItemText classes={{ primary: classes.primary }} inset primary="Inbox" />
</MenuItem>
</MenuList>
</Paper>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/demos/tables/EnhancedTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ EnhancedTableHead.propTypes = {

const toolbarStyles = theme => ({
root: {
paddingRight: 2,
paddingRight: theme.spacing.unit,
},
highlight:
theme.palette.type === 'light'
Expand Down
6 changes: 3 additions & 3 deletions pages/api/table-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Any other properties supplied will be [spread to the root element](/guides/api#s
You can override all the class names injected by Material-UI thanks to the `classes` property.
This property accepts the following keys:
- `root`
- `head`
- `footer`
- `hover`
- `typeHead`
- `typeFooter`
- `selected`
- `hover`

Have a look at [overriding with classes](/customization/overrides#overriding-with-classes) section
and the [implementation of the component](https://github.com/mui-org/material-ui/tree/v1-beta/src/Table/TableRow.js)
Expand Down
8 changes: 2 additions & 6 deletions src/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const styles = theme => ({
},
'&$disabled': {
boxShadow: theme.shadows[0],
backgroundColor: theme.palette.text.divider,
backgroundColor: theme.palette.action.disabledBackground,
},
'&:hover': {
backgroundColor: theme.palette.grey.A100,
Expand All @@ -88,11 +88,7 @@ export const styles = theme => ({
backgroundColor: theme.palette.grey[300],
},
'&$disabled': {
backgroundColor: theme.palette.text.divider,
// Reset on mouse devices
'@media (hover: none)': {
backgroundColor: theme.palette.grey[300],
},
backgroundColor: theme.palette.action.disabledBackground,
},
},
},
Expand Down
5 changes: 3 additions & 2 deletions src/Divider/Divider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import withStyles from '../styles/withStyles';
import { fade } from '../styles/colorManipulator';

export const styles = theme => ({
root: {
Expand All @@ -14,10 +15,10 @@ export const styles = theme => ({
marginLeft: 72,
},
default: {
backgroundColor: theme.palette.text.divider,
backgroundColor: theme.palette.line.divider,
},
light: {
backgroundColor: theme.palette.text.lightDivider,
backgroundColor: fade(theme.palette.line.divider, 0.08),
},
absolute: {
position: 'absolute',
Expand Down
8 changes: 4 additions & 4 deletions src/Drawer/Drawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ export const styles = theme => ({
maxHeight: '100vh',
},
paperAnchorDockedLeft: {
borderRight: `1px solid ${theme.palette.text.divider}`,
borderRight: `1px solid ${theme.palette.line.divider}`,
},
paperAnchorDockedTop: {
borderBottom: `1px solid ${theme.palette.text.divider}`,
borderBottom: `1px solid ${theme.palette.line.divider}`,
},
paperAnchorDockedRight: {
borderLeft: `1px solid ${theme.palette.text.divider}`,
borderLeft: `1px solid ${theme.palette.line.divider}`,
},
paperAnchorDockedBottom: {
borderTop: `1px solid ${theme.palette.text.divider}`,
borderTop: `1px solid ${theme.palette.line.divider}`,
},
modal: {}, // Just here so people can override the style.
});
Expand Down
4 changes: 2 additions & 2 deletions src/ExpansionPanel/ExpansionPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const styles = theme => {
height: 1,
content: '""',
opacity: 1,
backgroundColor: theme.palette.text.divider,
backgroundColor: theme.palette.line.divider,
transition: theme.transitions.create(['opacity', 'background-color'], transition),
},
'&:first-child': {
Expand Down Expand Up @@ -60,7 +60,7 @@ export const styles = theme => {
},
},
disabled: {
backgroundColor: theme.palette.text.divider,
backgroundColor: theme.palette.action.disabledBackground,
},
};
};
Expand Down
1 change: 0 additions & 1 deletion src/ExpansionPanel/ExpansionPanelSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export const styles = theme => {
},
disabled: {
opacity: 0.38,
color: theme.palette.action.disabled,
},
content: {
display: 'flex',
Expand Down
6 changes: 3 additions & 3 deletions src/List/ListItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const styles = theme => ({
position: 'relative',
},
keyboardFocused: {
backgroundColor: theme.palette.text.divider,
backgroundColor: theme.palette.action.hover,
},
default: {
paddingTop: 12,
Expand All @@ -31,7 +31,7 @@ export const styles = theme => ({
opacity: 0.5,
},
divider: {
borderBottom: `1px solid ${theme.palette.text.lightDivider}`,
borderBottom: `1px solid ${theme.palette.line.divider}`,
},
gutters: {
paddingLeft: theme.spacing.unit * 2,
Expand All @@ -43,7 +43,7 @@ export const styles = theme => ({
}),
'&:hover': {
textDecoration: 'none',
backgroundColor: theme.palette.text.divider,
backgroundColor: theme.palette.action.hover,
// Reset on mouse devices
'@media (hover: none)': {
backgroundColor: 'transparent',
Expand Down
8 changes: 4 additions & 4 deletions src/Menu/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export const styles = theme => ({
overflow: 'hidden',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
'&:hover': {
backgroundColor: theme.palette.text.lightDivider,
},
'&$selected': {
backgroundColor: theme.palette.text.divider,
backgroundColor: theme.palette.action.selected,
},
'&:hover': {
backgroundColor: theme.palette.action.hover,
},
},
selected: {},
Expand Down
4 changes: 2 additions & 2 deletions src/Table/TableCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const styles = theme => ({
borderBottom: `1px solid
${
theme.palette.type === 'light'
? lighten(fade(theme.palette.text.lightDivider, 1), 0.925)
: darken(fade(theme.palette.text.lightDivider, 1), 0.685)
? lighten(fade(theme.palette.line.divider, 1), 0.88)
: darken(fade(theme.palette.line.divider, 1), 0.8)
}`,
textAlign: 'left',
},
Expand Down
2 changes: 1 addition & 1 deletion src/Table/TableRow.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface TableRowProps extends StandardProps<TableRowBaseProps, TableRow

export type TableRowBaseProps = React.HTMLAttributes<HTMLTableRowElement>;

export type TableRowClassKey = 'root' | 'head' | 'footer' | 'hover' | 'selected';
export type TableRowClassKey = 'root' | 'typeHead' | 'typeFooter' | 'hover' | 'selected';

declare const TableRow: React.ComponentType<TableRowProps>;

Expand Down
22 changes: 14 additions & 8 deletions src/Table/TableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,26 @@ export const styles = theme => ({
},
verticalAlign: 'middle',
},
head: {
typeHead: {
height: 56,
},
footer: {
typeFooter: {
height: 56,
},
selected: {
backgroundColor:
theme.palette.type === 'light'
? 'rgba(0, 0, 0, 0.04)' // grey[100]
: 'rgba(255, 255, 255, 0.08)',
},
hover: {
'&:hover': {
backgroundColor: theme.palette.background.contentFrame,
backgroundColor:
theme.palette.type === 'light'
? 'rgba(0, 0, 0, 0.07)' // grey[200]
: 'rgba(255, 255, 255, 0.14)',
},
},
selected: {
backgroundColor: theme.palette.background.appBar,
},
});

/**
Expand All @@ -47,8 +53,8 @@ function TableRow(props, context) {
const className = classNames(
classes.root,
{
[classes.head]: table && table.head,
[classes.footer]: table && table.footer,
[classes.typeHead]: table && table.head,
[classes.typeFooter]: table && table.footer,
[classes.hover]: table && hover,
[classes.selected]: table && selected,
},
Expand Down
4 changes: 2 additions & 2 deletions src/Table/TableRow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ describe('<TableRow />', () => {
const wrapper = shallow(<TableRow />);
wrapper.setContext({ table: { head: true } });
assert.strictEqual(wrapper.hasClass(classes.root), true);
assert.strictEqual(wrapper.hasClass(classes.head), true, 'should have the head class');
assert.strictEqual(wrapper.hasClass(classes.typeHead), true, 'should have the head class');
});

it('should render with the footer class when in the context of a table footer', () => {
const wrapper = shallow(<TableRow />);
wrapper.setContext({ table: { footer: true } });
assert.strictEqual(wrapper.hasClass(classes.root), true);
assert.strictEqual(wrapper.hasClass(classes.footer), true, 'should have the footer class');
assert.strictEqual(wrapper.hasClass(classes.typeFooter), true, 'should have the footer class');
});
});
10 changes: 2 additions & 8 deletions src/colors/common.d.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
export interface CommonColors {
black: string;
white: string;
transparent: string;
black: string;
fullBlack: string;
darkBlack: string;
lightBlack: string;
minBlack: string;
faintBlack: string;
white: string;
fullWhite: string;
darkWhite: string;
lightWhite: string;
}

declare const common: CommonColors;
Expand Down
10 changes: 2 additions & 8 deletions src/colors/common.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
// @flow

const common = {
transparent: 'transparent',
black: '#000',
white: '#fff',
transparent: 'rgba(0, 0, 0, 0)',
fullBlack: 'rgba(0, 0, 0, 1)',
darkBlack: 'rgba(0, 0, 0, 0.87)',
lightBlack: 'rgba(0, 0, 0, 0.54)',
minBlack: 'rgba(0, 0, 0, 0.26)',
faintBlack: 'rgba(0, 0, 0, 0.12)',
white: '#fff',
fullWhite: 'rgba(255, 255, 255, 1)',
darkWhite: 'rgba(255, 255, 255, 0.87)',
lightWhite: 'rgba(255, 255, 255, 0.54)',
};

export default common;
Loading

0 comments on commit 903c87a

Please sign in to comment.