-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CalendarDay): add prop renderDayContent (#7518)
## Описание Необходимо добавить возможность отрисовки кастомного контента в ячейке дня календаря ## Изменения Добавлен пропс `renderDayContent` для отрисовки контента ## Release notes ## Улучшения - Calendar: Добавлен пропс `renderDayContent` для отрисовки кастомного контента в ячейке дня. Props также был добавлен в `CalendarRange`, `DateInput` и `DateRangeInput`
- Loading branch information
1 parent
3ad055d
commit ad82c81
Showing
12 changed files
with
104 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/vkui/src/testing/presets/createCalendarDayRenderField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { Icon12Education } from '@vkontakte/icons'; | ||
import { Caption } from '../../components/Typography/Caption/Caption'; | ||
import { DisplayTitle } from '../../components/Typography/DisplayTitle/DisplayTitle'; | ||
import { Text } from '../../components/Typography/Text/Text'; | ||
|
||
export const createCalendarDayRenderField = () => { | ||
return { | ||
control: 'select' as const, | ||
options: ['None', 'DayWithDayName', 'DayWithIcon'], | ||
mapping: { | ||
None: undefined, | ||
DayWithDayName: (date: Date) => { | ||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
width: '100%', | ||
}} | ||
> | ||
<DisplayTitle level="4" weight="2"> | ||
{date.getDate()} | ||
</DisplayTitle> | ||
<Caption caps level="2" weight="3"> | ||
{date.toLocaleDateString('ru-RU', { weekday: 'short' })} | ||
</Caption> | ||
</div> | ||
); | ||
}, | ||
DayWithIcon: (date: Date) => { | ||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
width: '100%', | ||
}} | ||
> | ||
<Text>{date.getDate()}</Text> | ||
<Icon12Education /> | ||
</div> | ||
); | ||
}, | ||
}, | ||
}; | ||
}; |