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

Consolidate classes naming #1950

merged 24 commits into from
Jul 14, 2020

Conversation

dmtrKovalenko
Copy link
Member

@dmtrKovalenko dmtrKovalenko commented Jul 3, 2020

edit @oliviertassinari

Related to #1778 and #1631.

@vercel
Copy link

vercel bot commented Jul 3, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/mui-org/material-ui-pickers/agvwk1473
✅ Preview: https://material-ui-pickers-git-feature-classes-naming.mui-org.vercel.app

@cypress
Copy link

cypress bot commented Jul 3, 2020



Test summary

78 0 3 0


Run details

Project material-ui-pickers
Status Passed
Commit 850a8da
Started Jul 14, 2020 9:34 AM
Ended Jul 14, 2020 9:35 AM
Duration 01:41 💡
OS Linux Debian - 10.0
Browser Chrome 80

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

import { createMuiTheme, ThemeProvider } from '@material-ui/core';
import { DatePicker, DatePickerProps } from '@material-ui/pickers';

const materialTheme = createMuiTheme({
overrides: {
MuiPickersToolbar: {
toolbar: {
MuiPickerToolbar: {
Copy link
Member

Choose a reason for hiding this comment

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

Could a version without an s feels inconsistent with the name of the package? @material-ui/pickers

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand, it was original intent of the naming, isn't it? (#1778) but we decided to move out?

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand either. What do you think of the last comment on #1778? If you agree with it, the intended name is

Suggested change
MuiPickerToolbar: {
MuiPickersToolbar: {

Copy link
Member

Choose a reason for hiding this comment

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

I still think that correct prefix is with a s to match the package name MuiPickersToolbar.

@@ -2,24 +2,21 @@ import { useStyles as DayStyles } from '../views/Calendar/Day';
import { useStyles as ClockStyles } from '../views/Clock/Clock';
import { useStyles as MuiBasePickerStyles } from '../Picker/Picker';
import { useStyles as CalendarStyles } from '../views/Calendar/Calendar';
import { useStyles as MuiPickersYearStyles } from '../views/Calendar/Year';
import { useStyles as MuiPickerYearStyles } from '../views/Calendar/Year';
Copy link
Member

Choose a reason for hiding this comment

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

I think that we will need to rename the components to so they can be imported and grep as they were in a single namespace.

Suggested change
import { useStyles as MuiPickerYearStyles } from '../views/Calendar/Year';
import { useStyles as MuiPickersYearStyles } from '../views/Calendar/PickerYear';

@vercel vercel bot temporarily deployed to Preview July 13, 2020 15:04 Inactive
@dmtrKovalenko
Copy link
Member Author

@oliviertassinari I am not sure that we need to name all the files with Picker it is the same as in the core repo you are not naming each file with Mui. Current solution works nice and keeps displayName/exportName in sync

@vercel vercel bot requested a deployment to Preview July 13, 2020 15:32 Abandoned
@vercel vercel bot requested a deployment to Preview July 13, 2020 15:36 Abandoned
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Nice! Happy to see that coming :D

import { createMuiTheme, ThemeProvider } from '@material-ui/core';
import { DatePicker, DatePickerProps } from '@material-ui/pickers';

const materialTheme = createMuiTheme({
overrides: {
MuiPickersToolbar: {
toolbar: {
MuiPickerToolbar: {
Copy link
Member

Choose a reason for hiding this comment

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

I still think that correct prefix is with a s to match the package name MuiPickersToolbar.

@@ -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!

lib/src/CalendarSkeleton.tsx Outdated Show resolved Hide resolved
lib/src/DateTimePicker/DateTimePickerTabs.tsx Outdated Show resolved Hide resolved
lib/src/Picker/Picker.tsx Outdated Show resolved Hide resolved
@@ -27,15 +27,15 @@ export const useStyles = makeStyles(
color: theme.palette.primary.main,
fontWeight: theme.typography.fontWeightMedium,
},
'&:disabled': {
pointerEvents: 'none',
color: theme.palette.text.hint,
Copy link
Member

Choose a reason for hiding this comment

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

⚠️

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, bad merge :)

Copy link
Member

Choose a reason for hiding this comment

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

Seems to be still present

lib/src/views/Calendar/Year.tsx Outdated Show resolved Hide resolved
lib/src/views/Clock/Clock.tsx Outdated Show resolved Hide resolved
@@ -102,5 +102,5 @@ export const styles = (theme: Theme) =>
});

export default withStyles(styles, {
name: 'MuiPickersClockPointer',
name: 'MuiPickerClockPointer',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
name: 'MuiPickerClockPointer',
name: 'MuiPickersClockPointer',

{
padding: '16px 24px',
},
{ name: 'MuiPickersMobileKeyboardInputView' }
Copy link
Member

Choose a reason for hiding this comment

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

Maybe? Not sure

Suggested change
{ name: 'MuiPickersMobileKeyboardInputView' }
{ name: 'MuiMobileKeyboardInputView' }

@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 13, 2020

@oliviertassinari I am not sure that we need to name all the files with Picker it is the same as in the core repo you are not naming each file with Mui. Current solution works nice and keeps displayName/exportName in sync

Do you mean on the file system?

@dmtrKovalenko
Copy link
Member Author

Yes I mean the file system

@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 13, 2020

So, assuming we bring nested imports, we would have?

import { PickersDay, PickersDayProps } from '@material-ui/pickers';
import PickersDay, { PickersDayProps } from '@material-ui/pickers/Day';

No strong point of view, points that support your proposal:

  1. People can figure that if Pickers is in the import name, it's already included in the package name, they can remove it
  2. We might progressively drop support for nested import (not sure, but maybe) Support for nested imports? #1934

👍 from my end

@dmtrKovalenko
Copy link
Member Author

dmtrKovalenko commented Jul 13, 2020

My point of view: We must drop support of public nested imports and default exports at all, we could discuss it separately :)

@oliviertassinari
Copy link
Member

My point of view: We must drop support of public nested imports and default exports at all

I'm pinning this subject, a potentially good one to discuss the next team meeting.

@vercel vercel bot temporarily deployed to Preview July 13, 2020 19:36 Inactive
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@vercel vercel bot temporarily deployed to Preview July 13, 2020 19:39 Inactive
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
// 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.

'&$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 :)

@@ -4,7 +4,7 @@ import { getByMuiTest } from './test-utils';
import { screen, waitFor } from '@testing-library/react';
import { utilsToUse, FakeTransitionComponent } from './test-utils';
import { createClientRender, fireEvent } from './createClientRender';
import { DatePicker, MobileDatePicker, DesktopDatePicker } from '@material-ui/pickers';
import { DatePicker, MobileDatePicker, DesktopDatePicker } from '../index';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import { DatePicker, MobileDatePicker, DesktopDatePicker } from '../index';
import { DatePicker, MobileDatePicker, DesktopDatePicker } from '@material-ui/pickers';

import { screen, waitFor } from '@testing-library/react';
import { utilsToUse, getAllByMuiTest } from './test-utils';
import { TextField, TextFieldProps } from '@material-ui/core';
import { DesktopDateRangePicker, StaticDateRangePicker } from '../';
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
import { DesktopDateRangePicker, StaticDateRangePicker } from '../';
import { DesktopDateRangePicker, StaticDateRangePicker } from '@material-ui/picker';

Copy link
Member Author

Choose a reason for hiding this comment

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

No it doesn’t work locally for some reason. Need investigation

@@ -27,15 +27,15 @@ export const useStyles = makeStyles(
color: theme.palette.primary.main,
fontWeight: theme.typography.fontWeightMedium,
},
'&:disabled': {
pointerEvents: 'none',
color: theme.palette.text.hint,
Copy link
Member

Choose a reason for hiding this comment

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

Seems to be still present

lib/src/views/Calendar/Year.tsx Outdated Show resolved Hide resolved
@oliviertassinari oliviertassinari self-requested a review July 14, 2020 08:44
@vercel vercel bot temporarily deployed to Preview July 14, 2020 09:29 Inactive
@dmtrKovalenko dmtrKovalenko merged commit 54faaad into next Jul 14, 2020
@dmtrKovalenko dmtrKovalenko deleted the feature/classes-naming branch July 14, 2020 10:30
todor-a pushed a commit to todor-a/material-ui-pickers that referenced this pull request Jul 18, 2020
* Change component name from MuiPickers to MuiPicker

* Name root classnames "root"

* Use pseudo-classes for disabled styling

* Remove useless yearDisabled class

* Update demo and typescript tests for overrides

* Repalce MuiPicker with MuiPickers

* Consolidate right component display name with mui component name

* Update index.ts reexports to match component display names

* Remove useless parameter

* Fix docs example

* Fix override example tsc

* Use pseudo-classes for selected and disabled, closes mui#1845

* Address PR feedback

* Update lib/src/Picker/Picker.tsx

Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>

* Update lib/src/views/Clock/Clock.tsx

Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>

* Make more convenient css classes names

* Remove today border from selected day

* Remove useless comment

* Update tests

* Fix global overrid of Mui-selected and Mui-disabled classes

* Use theme.palette.secondary instead of hint

* Fix linter

* Fix incorrect package prefix

Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants