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

Styling and Configuration Difficulties and Inconsistent Documentation #1901

Closed
neilchaudhuri opened this issue Jun 16, 2020 · 12 comments
Closed
Labels

Comments

@neilchaudhuri
Copy link

I am attempting to style a DatePicker so it approximates this specification:

image

I have figured out some of it, but I am having issues with the following:

  • No Today, OK, Cancel with variant inline
  • Unable to remove that toolbar and create a simple year dropdown. The sample code has no configuration for it, but there are multiple examples that look like this

image

  • Unable to configure the border color on select and a leading icon for the input. The renderInput prop described in the documentation is unavailable per TypeScript, and it is ignored in Storybook. Meanwhile, TextFieldComponent described in the documentation doesn't produce a calendar display when clicked.

Any guidance on these configurations--or an indication they are impossible--would be appreciated.

@oliviertassinari
Copy link
Member

It seems that you are referring to the v3 version of the component. Note that we only support v4 going forward.

@neilchaudhuri
Copy link
Author

I simply followed the installation instructions in the documentation, so you're saying that isn't valid?

@neilchaudhuri
Copy link
Author

OK, just checked NPM. Looks like the change made 12 days ago is for v4.0.0-alpha.8 but 3.2.10 is the latest stable. I will see about making a PR to update the documentation to clarify that the stable version is no longer supported.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 16, 2020

I meant that we have moved all efforts to https://next.material-ui-pickers.dev/.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 16, 2020

I will see about making a PR to update the documentation to clarify that the stable version is no longer supported.

Same with the main repository, we have moved all efforts to v5: https://next.material-ui.com. We also plan to merge the pickers into the main repository, before the stable release of v5.

@neilchaudhuri
Copy link
Author

I upgraded to the alpha, and I have found some things more aligned with my objective and others not so much:

  • Unable to add an outline of a specific color (that changes on focus)
  • Unable to add color to the trailing icon (let alone make it a leading icon but that's less critical)
  • Unable to really style anything much at all as my style object isn't changing the default. Here it is:
const customTheme = createMuiTheme({
    overrides: {
        MuiPickersToolbar: {
            toolbar: {
                backgroundColor: "#0071BC",
                color: "white"
            },
        },
        MuiPickersCalendarHeader: {
            switchHeader: {
                // backgroundColor: lightBlue.A200,
                // color: "white",
            },
        },
        MuiPickersDay: {
            day: {
                color: "#212121",
                fontFamily: "'Open Sans', sans-serif",
                backgroundColor: "white"
            },
            daySelected: {
                backgroundColor: "#0071BC",
                color:"white",
                borderRadius:"20px"
            },
            dayDisabled: {
                color: "#E4E5E6",
            },
            today: {
                color: "#212121",
            },
        }
    },
});

And

<ThemeProvider theme={customTheme}>
            <LocalizationProvider dateAdapter={DateFnsUtils}>
                <DatePicker...>
            </LocalizationProvider>
</ThemeProvider>

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 17, 2020

@neilchaudhuri Now, you get our interest :). Do you have a live reproduction we could dive into?

For context, even though we had a date picker one year ago, we had a lot of people that were asking for an official one: https://medium.com/material-ui/2019-material-ui-developer-survey-results-c9589434bbcf (date picker number one 1). I think the result can simply be explained by the fact that developers weren't happy with the state of affairs. I think that we took the right decisions and took the right direction to remedy the problem (hiring @dmtrKovalenko to work fulltime on the picker 6 months ago, working on a merge with the main repository mui/material-ui#19706, involving myself). We are probably >50% done on this path. It's taking much more time than anticipated but quality software doesn't happen overnight. We are still iterating on customizability, so this issue will greatly help.

@dmtrKovalenko dmtrKovalenko linked a pull request Jun 18, 2020 that will close this issue
@dmtrKovalenko
Copy link
Member

I suppose for this kind of customization you probably need to use internal components like Calendar and build your own version.

There are a couple of reasons for that:

  1. So hard customization mostly always leads to the problems when the inner structure changes
  2. It is becoming harder and harded to change something new.

I suppose that you could use our internal Calendar component to build your own version of wrapper

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 19, 2020

At this point, considering the main point raised by @neilchaudhuri, it seems that we can push the discussion further on how we can improve the CSS structure, to make it easier to customize.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 19, 2020

I'm adding a docs label. I think that we can aim to provide such customization demo. It will force us to dive into the pain points, and hopefully make improvements. Linking it to mui/material-ui#20960

@Jesusz0r
Copy link

Hi @oliviertassinari. Do you know how can I style the "OK" and "Cancel" button? I'm using createMuiTheme but can't seem to find the right way to access it

@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 24, 2020

@Jesusz0r Is styling the Button component directly (globally) enough? What else do you need?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants