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

Partial removal of lodash from charts, docs, selectable and datepicker components #3053

Merged
merged 12 commits into from
Mar 24, 2020
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Replaced various `lodash` functions with native functions ([#3053](https://github.com/elastic/eui/pull/3053))
- Added `whiteSpace ` prop to `EuiCodeBlock` ([#3103](https://github.com/elastic/eui/pull/3103))
- Added `sortMatchesBy` prop for `EuiComboBox` ([#3089](https://github.com/elastic/eui/pull/3089))
- Added `prepend` and `append` ability to `EuiFieldPassword` ([#3122](https://github.com/elastic/eui/pull/3122))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import React from "react";
import DatePicker from "react-datepicker";
import moment from "moment";
import range from "lodash/range";
import React from 'react';
anishagg17 marked this conversation as resolved.
Show resolved Hide resolved
import DatePicker from 'react-datepicker';
import moment from 'moment';

const range = (start, end, step = 1) =>
Array.from(
{ length: (end - start + step - 1) / step },
(_, i) => i * step + start
);

const years = range(1990, moment().year() + 1, 1);
const months = moment.months();
Expand All @@ -10,13 +15,13 @@ export default class Default extends React.Component {
constructor(props) {
super(props);
this.state = {
startDate: moment()
startDate: moment(),
};
}

handleChange = date => {
this.setState({
startDate: date
startDate: date,
});
};

Expand Down Expand Up @@ -51,25 +56,22 @@ export default class Default extends React.Component {
decreaseMonth,
increaseMonth,
prevMonthButtonDisabled,
nextMonthButtonDisabled
nextMonthButtonDisabled,
}) => (
<div
style={{
margin: 10,
display: "flex",
justifyContent: "center"
}}
>
display: 'flex',
justifyContent: 'center',
}}>
<button
onClick={decreaseMonth}
disabled={prevMonthButtonDisabled}
>
{"<"}
disabled={prevMonthButtonDisabled}>
{'<'}
</button>
<select
value={date.year()}
onChange={({ target: { value } }) => changeYear(value)}
>
onChange={({ target: { value } }) => changeYear(value)}>
{years.map(option => (
<option key={option} value={option}>
{option}
Expand All @@ -79,8 +81,7 @@ export default class Default extends React.Component {

<select
value={months[date.month()]}
onChange={({ target: { value } }) => changeMonth(value)}
>
onChange={({ target: { value } }) => changeMonth(value)}>
{months.map(option => (
<option key={option} value={option}>
{option}
Expand All @@ -90,9 +91,8 @@ export default class Default extends React.Component {

<button
onClick={increaseMonth}
disabled={nextMonthButtonDisabled}
>
{">"}
disabled={nextMonthButtonDisabled}>
{'>'}
</button>
</div>
)}
Expand Down
Loading