-
Notifications
You must be signed in to change notification settings - Fork 834
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
The demos should work in isolation #1650
Comments
What do you prefer? Wrap each demo in |
I think that we should have both:
Regarding testing with different date engines, I imagine it's much more a library maintainer concern than a developer concern. However, I think that the demos could accept an optional util prop coming from the outside. Would it work? My only concern is with the overhead of these the demos. But I think that it's healthy, it incentive us to make configuration as easy as possible for developers. |
We will also need to remove all imports from docs folders, for instance import { makeJSDateObject } from "../../../utils/helpers"; |
I mean using context provider in each example or pass dateAdapter right to the pickers? https://next.material-ui-pickers.dev/guides/date-adapter-passing |
@dmtrKovalenko What about this structure?
import React from "react";
import LocalizationProvider from "@material-ui/pickers/LocalizationProvider";
import DesktopDatePicker from "@material-ui/pickers/DesktopDatePicker";
import dateAdapter from "@material-ui/pickers/adapters/date-fns";
function withContext(Component) {
return (props) => (
<LocalizationProvider dateAdapter={props.dateAdapter || dateAdapter}>
<Component />
</LocalizationProvider>
);
}
function AdvancedKeyboardExample(props) {
const [selectedDate, handleDateChange] = React.useState(new Date());
return (
<DesktopDatePicker
autoOk
variant="outlined"
label="Advanced keyboard"
placeholder="2018/01/01"
inputFormat="yyyy/MM/dd"
mask="____/__/__"
value={selectedDate}
onError={a => {
console.log("error", a);
}}
onChange={date => handleDateChange(date)}
/>
);
}
export default withContext(AdvancedKeyboardExample); |
mui/material-ui#20878 made me think of this issue, adding the v5 label per the internal discussion we had around:
|
A counter-proposal plan to #1650 (comment) for this:
|
It was fixed in https://next.material-ui.com/components/pickers/ |
Environment
Steps to reproduce
Expected behavior
The demos should all be working in isolation, no matter the cost. I think that it's a critical point required to minimize churn during the first few minutes a developer try this option (competing libraries) out.
The text was updated successfully, but these errors were encountered: