2019-09-10 11:28:56 +00:00
|
|
|
import React from "react";
|
|
|
|
import PropTypes from "prop-types";
|
|
|
|
|
2021-02-12 10:34:27 +00:00
|
|
|
import Text from "../../text";
|
2021-02-25 12:16:52 +00:00
|
|
|
import { isArrayEqual } from "../../utils/array";
|
2021-02-12 10:34:27 +00:00
|
|
|
import { StyledWeekdays, StyledWeekday } from "../styled-calendar";
|
2019-09-10 11:28:56 +00:00
|
|
|
|
|
|
|
class Weekdays extends React.Component {
|
|
|
|
shouldComponentUpdate(nextProps) {
|
|
|
|
const { optionsWeekdays, size } = this.props;
|
|
|
|
if (
|
|
|
|
isArrayEqual(optionsWeekdays, nextProps.optionsWeekdays) &&
|
|
|
|
size === nextProps.size
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
render() {
|
|
|
|
//console.log("Weekdays render");
|
|
|
|
const { optionsWeekdays, size } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<StyledWeekdays size={size}>
|
|
|
|
{optionsWeekdays.map((weekday, index) => {
|
|
|
|
return (
|
2021-02-12 10:34:27 +00:00
|
|
|
<StyledWeekday key={index} disable={weekday.disabled}>
|
|
|
|
<Text isBold={true} className={"calendar-weekday_text"}>
|
2019-09-10 11:28:56 +00:00
|
|
|
{" "}
|
|
|
|
{weekday.value}{" "}
|
2019-12-04 09:36:13 +00:00
|
|
|
</Text>
|
2021-02-12 10:34:27 +00:00
|
|
|
</StyledWeekday>
|
2019-09-10 11:28:56 +00:00
|
|
|
);
|
|
|
|
})}
|
|
|
|
</StyledWeekdays>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Weekdays.propTypes = {
|
|
|
|
optionsWeekdays: PropTypes.array,
|
2020-10-16 13:16:01 +00:00
|
|
|
size: PropTypes.string,
|
2019-09-10 11:28:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default Weekdays;
|