-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
42a54ac
commit 9cfb844
Showing
6 changed files
with
41 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Get and change every day | ||
|
||
By having access to each day, we may post additional information or otherwise change each day on the calendar. | ||
|
||
As an example, let's add a random cost to each day. | ||
|
||
<Sandbox example="action-handlers-get-and-change-every-day" /> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Получить и изменить каждый день | ||
|
||
Имея доступ к каждому дню, мы можем публиковать дополнительную информацию или иным образом изменять каждый день в календаре. | ||
|
||
В качестве примера давайте добавим рандомную стоимость к каждому дню. | ||
|
||
<Sandbox example="action-handlers-get-and-change-every-day" /> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import VanillaCalendar from '@uvarov.frontend/vanilla-calendar'; | ||
import '@uvarov.frontend/vanilla-calendar/build/vanilla-calendar.min.css'; | ||
import '@uvarov.frontend/vanilla-calendar/build/themes/light.min.css'; | ||
import '@uvarov.frontend/vanilla-calendar/build/themes/dark.min.css'; | ||
|
||
const options = { | ||
actions: { | ||
getDays(day, date, HTMLElement, HTMLButtonElement) { | ||
const randomBoolean = Math.random() < 0.5; | ||
if (!randomBoolean) return; | ||
const randomPrice = Math.floor(Math.random() * (999 - 100 + 1) + 100); | ||
|
||
HTMLButtonElement.style.flexDirection = 'column'; | ||
HTMLButtonElement.innerHTML = ` | ||
<span>${day}</span> | ||
<span style="font-size: 8px;color: #8BC34A;">$${randomPrice}</span> | ||
`; | ||
}, | ||
}, | ||
}; | ||
|
||
const calendar = new VanillaCalendar('#calendar', options); | ||
calendar.init(); |
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