Skip to content

Commit

Permalink
address last comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova committed Apr 19, 2021
1 parent a36780c commit 6c22e09
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled';
import Typography from '@material-ui/core/Typography';
import TimelineContext from '../Timeline/TimelineContext';
import TimelineItemContext from '../TimelineItem/TimelineItemContext';
import { getTimelineContentUtilityClass } from './timelineContentClasses';

const overridesResolver = (props, styles) => {
Expand Down Expand Up @@ -50,7 +49,6 @@ const TimelineContent = React.forwardRef(function TimelineContent(inProps, ref)
const { className, ...other } = props;

const { align = 'left' } = React.useContext(TimelineContext);
const { classes: contextClasses = {} } = React.useContext(TimelineItemContext);

const styleProps = {
...props,
Expand All @@ -62,7 +60,7 @@ const TimelineContent = React.forwardRef(function TimelineContent(inProps, ref)
return (
<TimelineContentRoot
component="div"
className={clsx(classes.root, contextClasses.content, className)}
className={clsx(classes.root, className)}
styleProps={styleProps}
ref={ref}
{...other}
Expand Down
25 changes: 10 additions & 15 deletions packages/material-ui-lab/src/TimelineItem/TimelineItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import {
unstable_useThemeProps as useThemeProps,
} from '@material-ui/core/styles';
import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled';
import { timelineContentClasses } from '../TimelineContent';
import { timelineOppositeContentClasses } from '../TimelineOppositeContent';
import TimelineContext from '../Timeline/TimelineContext';
import TimelineItemContext from './TimelineItemContext';
import timelineItemClasses, { getTimelineItemUtilityClass } from './timelineItemClasses';

const overridesResolver = (props, styles) => {
Expand Down Expand Up @@ -56,10 +57,10 @@ const TimelineItemRoot = experimentalStyled(
...(styleProps.align === 'alternate' && {
'&:nth-child(even)': {
flexDirection: 'row-reverse',
'& .MuiTimelineItem-content': {
[`& .${timelineContentClasses.root}`]: {
textAlign: 'right',
},
'& .MuiTimelineItem-oppositeContent': {
[`& .${timelineOppositeContentClasses.root}`]: {
textAlign: 'left',
},
},
Expand Down Expand Up @@ -95,18 +96,12 @@ const TimelineItem = React.forwardRef(function TimelineItem(inProps, ref) {
const classes = useUtilityClasses(styleProps);

return (
<TimelineItemContext.Provider
value={{
classes: { content: classes.content, oppositeContent: classes.oppositeContent },
}}
>
<TimelineItemRoot
className={clsx(classes.root, className)}
styleProps={styleProps}
ref={ref}
{...other}
/>
</TimelineItemContext.Provider>
<TimelineItemRoot
className={clsx(classes.root, className)}
styleProps={styleProps}
ref={ref}
{...other}
/>
);
});

Expand Down
12 changes: 0 additions & 12 deletions packages/material-ui-lab/src/TimelineItem/TimelineItemContext.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { capitalize } from '@material-ui/core/utils';
import { unstable_composeClasses as composeClasses } from '@material-ui/unstyled';
import Typography from '@material-ui/core/Typography';
import TimelineContext from '../Timeline/TimelineContext';
import TimelineItemContext from '../TimelineItem/TimelineItemContext';
import { getTimelineOppositeContentUtilityClass } from './timelineOppositeContentClasses';

const overridesResolver = (props, styles) => {
Expand Down Expand Up @@ -58,7 +57,6 @@ const TimelineOppositeContent = React.forwardRef(function TimelineOppositeConten
const { className, ...other } = props;

const { align = 'left' } = React.useContext(TimelineContext);
const { classes: contextClasses = {} } = React.useContext(TimelineItemContext);

const styleProps = {
...props,
Expand All @@ -70,7 +68,7 @@ const TimelineOppositeContent = React.forwardRef(function TimelineOppositeConten
return (
<TimelineOppositeContentRoot
component="div"
className={clsx(classes.root, contextClasses.oppositeContent, className)}
className={clsx(classes.root, className)}
styleProps={styleProps}
ref={ref}
{...other}
Expand Down

0 comments on commit 6c22e09

Please sign in to comment.