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

Consolidate classes naming #1950

Merged
merged 24 commits into from
Jul 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
85ae0c0
Change component name from MuiPickers to MuiPicker
dmtrKovalenko Jul 3, 2020
0568a89
Name root classnames "root"
dmtrKovalenko Jul 3, 2020
554d34e
Use pseudo-classes for disabled styling
dmtrKovalenko Jul 3, 2020
d75bf55
Remove useless yearDisabled class
dmtrKovalenko Jul 3, 2020
2b4274d
Update demo and typescript tests for overrides
dmtrKovalenko Jul 3, 2020
1d2bf35
Merge conflicts
dmtrKovalenko Jul 13, 2020
737f343
Repalce MuiPicker with MuiPickers
dmtrKovalenko Jul 13, 2020
73a144d
Consolidate right component display name with mui component name
dmtrKovalenko Jul 13, 2020
33f4f12
Update index.ts reexports to match component display names
dmtrKovalenko Jul 13, 2020
e7b8b48
Remove useless parameter
dmtrKovalenko Jul 13, 2020
1720a0b
Fix docs example
dmtrKovalenko Jul 13, 2020
3e2cd6c
Fix override example tsc
dmtrKovalenko Jul 13, 2020
1e72edf
Use pseudo-classes for selected and disabled, closes #1845
dmtrKovalenko Jul 13, 2020
27c5fec
Address PR feedback
dmtrKovalenko Jul 13, 2020
dc073e3
Update lib/src/Picker/Picker.tsx
dmtrKovalenko Jul 13, 2020
145bfa8
Update lib/src/views/Clock/Clock.tsx
dmtrKovalenko Jul 13, 2020
62bed3a
Make more convenient css classes names
dmtrKovalenko Jul 13, 2020
e7d7079
Remove today border from selected day
dmtrKovalenko Jul 14, 2020
3ce0f32
Remove useless comment
dmtrKovalenko Jul 14, 2020
dc95144
Update tests
dmtrKovalenko Jul 14, 2020
82f6614
Fix global overrid of Mui-selected and Mui-disabled classes
dmtrKovalenko Jul 14, 2020
3246564
Use theme.palette.secondary instead of hint
dmtrKovalenko Jul 14, 2020
634d638
Fix linter
dmtrKovalenko Jul 14, 2020
850a8da
Fix incorrect package prefix
dmtrKovalenko Jul 14, 2020
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
4 changes: 2 additions & 2 deletions docs/pages/demo/datepicker/CustomDay.example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import startOfWeek from 'date-fns/startOfWeek';
import TextField from '@material-ui/core/TextField';
import isWithinInterval from 'date-fns/isWithinInterval';
import { makeStyles } from '@material-ui/core';
import { DatePicker, Day } from '@material-ui/pickers';
// this guy required only on the docs site to work with dynamic date library
import { makeJSDateObject } from '../../../utils/helpers';
import { DatePicker, PickersDay } from '@material-ui/pickers';
Copy link
Member

@oliviertassinari oliviertassinari Jul 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, look like eslint-plugin-pretty-imports comes with a new cost I didn't see coming (first one is that it requires running eslint --fix): it creates harder review and git diff: it's moving code around.


const useStyles = makeStyles(theme => ({
highlight: {
Expand Down Expand Up @@ -45,7 +45,7 @@ function WeekPicker(props) {
const isLastDay = isSameDay(dateClone, end);

return (
<Day
<PickersDay
{...DayComponentProps}
disableMargin
className={clsx({
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/demo/datepicker/ServerRequest.example.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import Badge from '@material-ui/core/Badge';
import TextField from '@material-ui/core/TextField';
import { DatePicker, Day } from '@material-ui/pickers';
import { makeJSDateObject } from '../../../utils/helpers';
import { DatePicker, PickersDay } from '@material-ui/pickers';
import { CalendarSkeleton } from '@material-ui/pickers/CalendarSkeleton';

export default function ServerRequest() {
Expand Down Expand Up @@ -55,7 +55,7 @@ export default function ServerRequest() {
overlap="circle"
badgeContent={isSelected ? '🌚' : undefined}
>
<Day {...DayComponentProps} />
<PickersDay {...DayComponentProps} />
</Badge>
);
}}
Expand Down
5 changes: 3 additions & 2 deletions docs/pages/guides/ControllingProgrammatically.example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import React, { useState } from 'react';
import TextField from '@material-ui/core/TextField';
import { DatePicker } from '@material-ui/pickers';
import { Button, makeStyles } from '@material-ui/core';

const useStyles = makeStyles({
container: {
root: {
display: 'flex',
flexDirection: 'column',
},
Expand All @@ -15,7 +16,7 @@ function ControllingProgrammaticallyExample() {
const [selectedDate, handleDateChange] = useState('2018-01-01T00:00:00.000Z');

return (
<div className={classes.container}>
<div className={classes.root}>
<Button onClick={() => setIsOpen(true)}> Open picker </Button>

<DatePicker
Expand Down
23 changes: 12 additions & 11 deletions docs/pages/guides/CssOverrides.example.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState } from 'react';
import isWeekend from 'date-fns/isWeekend';
import TextField from '@material-ui/core/TextField';
import lightBlue from '@material-ui/core/colors/lightBlue';
import { createMuiTheme, ThemeProvider } from '@material-ui/core';
Expand All @@ -7,25 +8,25 @@ import { DatePicker, DatePickerProps } from '@material-ui/pickers';
const materialTheme = createMuiTheme({
overrides: {
MuiPickersToolbar: {
toolbar: {
root: {
backgroundColor: lightBlue.A200,
},
},
MuiPickersCalendarHeader: {
switchHeader: {
root: {
// backgroundColor: lightBlue.A200,
// color: 'white',
},
},
MuiPickersDay: {
day: {
root: {
color: lightBlue.A700,
},
daySelected: {
backgroundColor: lightBlue['400'],
},
dayDisabled: {
color: lightBlue['100'],
'&$disabled': {
color: lightBlue['100'],
},
'&$selected': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the change of pseudo classes, I think that we could have handled in a different pull request, keeping our focus on a single topic at the time :)

backgroundColor: lightBlue['400'],
},
},
today: {
color: lightBlue['900'],
Expand All @@ -45,12 +46,12 @@ function CssOverrides() {
return (
<ThemeProvider theme={materialTheme}>
<DatePicker
renderInput={props => <TextField {...props} />}
label="Light blue picker"
value={selectedDate}
onChange={date => handleDateChange(date)}
renderInput={props => <TextField {...props} />}
// @ts-ignore
shouldDisableDate={day => day && day.getDay() === 0}
shouldDisableDate={isWeekend}
/>
</ThemeProvider>
);
Expand Down
6 changes: 3 additions & 3 deletions docs/pages/regression/RegressionDay.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { IUtils } from '@date-io/core/IUtils';
import { Day, DayProps } from '@material-ui/pickers';
import { PickersDay, PickersDayProps } from '@material-ui/pickers';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect!


export const createRegressionDay = (utils: IUtils<any>) => (
day: any,
selectedDate: any,
dayProps: DayProps
dayProps: PickersDayProps
) => {
return <Day {...dayProps} data-day={utils.formatByString(day, 'dd/MM/yyyy')} />;
return <PickersDay {...dayProps} data-day={utils.formatByString(day, 'dd/MM/yyyy')} />;
};
Loading