Skip to content

Commit

Permalink
docs(DatePicker,Calendar): remove period props (#3452)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashachabin authored Jun 25, 2024
1 parent 85dd419 commit fc9e26c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 29 deletions.
12 changes: 0 additions & 12 deletions packages/react-ui/components/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,6 @@ export interface CalendarProps extends CommonProps {
* Дата задаётся в формате `dd.mm.yyyy`
*/
minDate?: string;
/**
* Задаёт начальную дату периода
*
* Дата задаётся в формате `dd.mm.yyyy`
*/
periodStartDate?: string;
/**
* Задаёт конечную дату периода
*
* Дата задаётся в формате `dd.mm.yyyy`
*/
periodEndDate?: string;
/**
* Функция для определения праздничных дней
* @default (_day, isWeekend) => isWeekend
Expand Down
27 changes: 10 additions & 17 deletions packages/react-ui/components/DatePicker/DatePicker.md
Original file line number Diff line number Diff line change
Expand Up @@ -274,30 +274,23 @@ class DatePickerFormatting extends React.Component {
<DatePickerFormatting />;
```

### Период дат
Подбробный пример в [Calendar](#/Components/Calendar)

```jsx harmony
const [value, setValue] = React.useState('12.05.2022');

<DatePicker
value={value}
onValueChange={setValue}
periodStartDate="16.05.2022"
periodEndDate="20.05.2022"
/>;
```

### Кастомный рендер дня
Подбробный пример в [Calendar](#/Components/Calendar)

```jsx harmony
import { CalendarDay } from "@skbkontur/react-ui";

const [value, setValue] = React.useState('12.05.2022');

const renderDay = (date, defaultProps, RenderDefault) => {
const isEven = defaultProps.children % 2 === 0;
const renderDay = (props) => {
const [date] = props.date.split('.').map(Number);
const isEven = date % 2 === 0;

return <RenderDefault {...defaultProps} isDisabled={isEven} />;
if (isEven) {
return <CalendarDay {...props} style={{ background: '#e9f8e3' }} />
}

return <CalendarDay {...props} />
};


Expand Down

0 comments on commit fc9e26c

Please sign in to comment.